私は今働いているangle2-seedプロジェクトをセットアップしようとしましたが、今は自分の環境にPrimeNGを追加したいのですが、angle2-seedでPrimeNGを実装する方法
オフコース私の最初のステップ:
import {Component} from 'angular2/core';
import {CORE_DIRECTIVES, FORM_DIRECTIVES} from 'angular2/common';
import {PieChart} from 'primeng/primeng';
@Component({
selector: 'sd-stats',
moduleId: module.id,
templateUrl: './stats.component.html',
styleUrls: ['./stats.component.css'],
directives: [FORM_DIRECTIVES, CORE_DIRECTIVES, PieChart]
})
export class StatsComponent {
data: any[];
constructor() {
this.data = [{
value: 300,
color: '#F7464A',
highlight: '#FF5A5E',
label: 'Red'
},
{
value: 50,
color: '#46BFBD',
highlight: '#5AD3D1',
label: 'Green'
},
{
value: 100,
color: '#FDB45C',
highlight: '#FFC870',
label: 'Yellow'
}];
}
}
htmlファイル
:primengとその後npm install primeng --save
npm install primeui --save
primeuiをインストールして、私は私のコンポーネントは、このようになりますhttps://github.com/mgechev/angular2-seed/blob/master/tools/config/seed.config.ts#L129
@マッピングを追加しました
<p-pieChart [value]="data" width="300" height="300"></p-pieChart>
これで十分ではありませんでした。 私はまだ以下のCSSを追加する必要があると思います& jsファイルですが、私はどこを知りません!
<link rel="stylesheet" type="text/css" href="node_modules/primeui/themes/delta/theme.css" />
<link rel="stylesheet" type="text/css" href="node_modules/primeui/primeui-ng-all.css" />
<script src="node_modules/primeui/primeui-ng-all.js"></script>
と私は以前の手順が正しいかどうかはわかりません。現時点で私はエラーを受け取りました:
EXCEPTION: ReferenceError: Chart is not defined