码迷,mamicode.com
首页 > 其他好文 > 详细

angular项目中使用jQWidgets

时间:2017-09-15 22:39:19      阅读:297      评论:0      收藏:0      [点我收藏+]

标签:please   span   install   selector   name   ref   www.   image   tutorial   

Angular CLI with jQWidgets

In this tutorial, we will show you how to use https://cli.angular.io/ along with the Angular Components by jQWidgets.
Please, follow the step by step instructions below:

 

  • npm install -g angular-cli
  • ng new myProject
  • cd myProject
  • npm install jqwidgets-framework --save
  • ng serve
  • Edit src/index.html:
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Jqwidgets</title>
    <base href="/">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" type="image/x-icon" href="favicon.ico">
    <!-- Styles -->
    <link rel="stylesheet" href="http://www.jqwidgets.com/public/jqwidgets/styles/jqx.base.css" type="text/css" />
    <!-- jQWidgets -->
    <script src="http://www.jqwidgets.com/public/jqwidgets/jqxcore.js"></script>
    <script src="http://www.jqwidgets.com/public/jqwidgets/jqxdraw.js"></script>
    <script src="http://www.jqwidgets.com/public/jqwidgets/jqxbargauge.js"></script>
    </head>
    <body>
    <app-root>Loading...</app-root>
    </body>
    </html>
     
  • Edit src/app.component.ts:
    import { Component } from ‘@angular/core‘;
    import { jqxBarGaugeComponent } from ‘jqwidgets-framework/jqwidgets-ts/angular_jqxbargauge‘;
    @Component({
    selector: ‘app-root‘,
    templateUrl: ‘./app.component.html‘,
    styleUrls: [‘./app.component.css‘]
    })
    export class AppComponent {
    values: number[] = [102, 115, 130, 137];
    }
     
  • Edit src/app.component.html:
    <jqxBarGauge
    [width]="600" [height]="600" [colorScheme]="‘scheme02‘"
    [max]="150" [values]="values">
    </jqxBarGauge>
     
  • Edit src/app.module.ts:
    import { BrowserModule } from ‘@angular/platform-browser‘;
    import { NgModule } from ‘@angular/core‘;
    import { FormsModule } from ‘@angular/forms‘;
    import { HttpModule } from ‘@angular/http‘;
    import { AppComponent } from ‘./app.component‘;
    import { jqxBarGaugeComponent } from ‘jqwidgets-framework/jqwidgets-ts/angular_jqxbargauge‘;
    @NgModule({
    declarations: [
    AppComponent,
    jqxBarGaugeComponent
    ],
    imports: [
    BrowserModule,
    FormsModule,
    HttpModule
    ],
    providers: [],
    bootstrap: [AppComponent]
    })
    export class AppModule { }
     
  • Navigate to http://localhost:4200/ in your web browser
  • Result:技术分享

 

angular项目中使用jQWidgets

标签:please   span   install   selector   name   ref   www.   image   tutorial   

原文地址:http://www.cnblogs.com/kaid/p/7528662.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!