我试图在我的 Angular 2 应用程序中显示一个简单的高图,但它总是给我以下错误:
这是我的 app.module.ts:
import { ChartModule } from 'angular2-highcharts';
@NgModule({
imports: [
ChartModule.forRoot('highcharts')
]
})
export class AppModule {
}
我的 sistemjs.config.js:
map: {
'angular2-highcharts': 'npm:angular2-highcharts',
'highcharts': 'npm:highcharts'
},
packages: {
highcharts: {
main: './highcharts.js',
defaultExtension: 'js'
},
'angular2-highcharts': {
main: './index.js',
defaultExtension: 'js'
}
}
而且,在我的组件内部:
import { Component } from '@angular/core';
import { ChartModule } from 'angular2-highcharts';
@Component({
selector: 'highchart',
template: '<chart [options]="options">'
})
constructor() {
this.options = {
title : { text : 'angular2-highcharts example' },
series: [{
name: 's1',
data: [2,3,5,8,13],
allowPointSelect: true
},{
name: 's2',
data: [-2,-3,-5,-8,-13],
allowPointSelect: true
}]
};
console.log(this.options);
}
options: Object;
有任何想法吗?非常感谢。