JHipster 4.1.1和Highchart(Angular2)

时间:2017-04-02 07:31:15

标签: angular highcharts jhipster

我正在尝试将Highchart库集成到我的JHipster 4.1.1项目中。 我按照本网站的步骤进行操作

https://www.npmjs.com/package/angular2-highcharts

1 - 我在项目的根目录下运行以下命令

npm install angular2-highcharts --save

2 - 我在模块文件中添加以下内容:

import { ChartModule } from 'angular2-highcharts';

@NgModule({
imports: [
BrowserModule,
ChartModule.forRoot(require('highcharts')),

3-我的home.component.ts文件如下所示: 从' @ angular / core';

导入{Component}
import { Component } from '@angular/core';
@Component({
selector: 'jhi-home',
  template: '<chart [options]="options"></chart>'
})

export class HomeComponent {
constructor() {
this.options = {
  title: { text: 'simple chart' },
  series: [{
    data: [29.9, 71.5, 106.4, 129.2],
  }]
};
}
options: Object; 
}

它给我以下错误

Promise rejection: Template parse errors:
Can't bind to 'options' since it isn't a known property of 'chart'. ("<chart [ERROR ->][options]="options"></chart>"): HomeComponent@0:7
'chart' is not a known element:
1. If 'chart' is an Angular component, then verify that it is part of this module.
2. If 'chart' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("[ERROR ->]<chart [options]="options"></chart>"): HomeComponent@0:0 ; Zone: <root> ; Task: Promise.then ;

有人可以帮助我。

0 个答案:

没有答案