xieziyu / ngx-echarts

An angular (ver >= 2.x) directive for ECharts (ver >= 3.x)
https://xieziyu.github.io/ngx-echarts/
MIT License
1.1k stars 195 forks source link

按GITHUB上示例,无法跑起来? #56

Open 1166544 opened 6 years ago

1166544 commented 6 years ago

core.es5.js:1084 ERROR Error: Uncaught (in promise): Error: Template parse errors: Can't bind to 'options' since it isn't a known property of 'div'. (" <div echarts [ERROR ->][options]="echartOption" class="demo-chart">

): ng:///GoodsManageModule/SelfListsSearch.html@2:13 Error: Template parse errors: Can't bind to 'options' since it isn't a known property of 'div'.

请帮忙看下。 步骤:

1.npm install echarts --save npm install ngx-echarts --save

  1. "../node_modules/echarts/dist/echarts.min.js"

  2. import { NgxEchartsModule } from 'ngx-echarts';

@NgModule({ imports: [ ..., NgxEchartsModule ], ... }) export class AppModule { }

  1. Simple example:

html: <div echarts [options]="chartOption" class="demo-chart">

....

xieziyu commented 6 years ago

看问题是NgxEchartsModule没有被正确import到使用的module中。

FaussYao commented 6 years ago

嗯 是的 我也遇到过 解决方法 在我echarts 组件当前所在的shared module中import NgxEchartsModule