我想在Angular2項目(核心v2.1.1)中使用ng2-nvd3(https://github.com/krispo/ng2-nvd3),但它不起作用。Angular2上的ng2-nvD3 2.1.1
我已經把nvD3在我@MgModule聲明:
declarations: [
...
TestComponent,
nvD3,
],
,我已經設置了所描述的成分:
import {Component} from '@angular/core';
import {nvD3} from 'ng2-nvd3';
declare let d3:any;
@Component({
template: '<div><nvd3 [options]="options" [data]="data"></nvd3></div>'
})
export class TestComponent {
options;
data;
ngOnInit(){
this.options = {
chart: {
type: 'discreteBarChart',
height: 450,
margin : {
...
,但我得到的錯誤:
EXCEPTION: Uncaught (in promise): Error: Error in ./TestComponent class TestComponent - inline template:0:31 caused by: nv is not defined
我已經在我的package.json文件中有nvd3和d3,但我不確定我應該如何處理它們。
HM,我嘗試同樣通過複製本地文件(由NG2-nvd3引用),但仍然導致錯誤,可能是錯誤的版本。 – Akzidenzgrotesk
你確定它是正確的參考嗎? – methgaard