0
votes

I am using ngx-echart in angular 7 application. I am following the example in the link: https://www.freakyjolly.com/angular-e-charts-using-ngx-echarts-tutorial/#.XwSANigzaUk

But when executing (ng serve) the application, and display the component, I am getting the below error:

ERROR Error: StaticInjectorError(AppModule)[NgxEchartsDirective -> InjectionToken NGX_ECHARTS_CONFIG]: StaticInjectorError(Platform: core)[NgxEchartsDirective -> InjectionToken NGX_ECHARTS_CONFIG]: NullInjectorError: No provider for InjectionToken NGX_ECHARTS_CONFIG! at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:8896) at resolveToken (core.js:9141) at tryResolveToken (core.js:9085) at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:8982) at resolveToken (core.js:9141) at tryResolveToken (core.js:9085) at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:8982) at resolveNgModuleDep (core.js:21218) at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:21907) at resolveNgModuleDep (core.js:21218)

Any idea ?

Thanks

2

2 Answers

4
votes

You need to add NgxEchartsModule.forRoot({ echarts }) in your module

import { NgxEchartsModule } from 'ngx-echarts';
import * as echarts from 'echarts';
0
votes

It seems it was a package installation issue. I installed only ngx-echarts. after following the steps on the link below, I've got everything fine

https://www.npmjs.com/package/ngx-echarts

Thank you