Ng2-charts: Error after updating the vesion 2.3.2 to 2.4.0

Created on 2 Sep 2020  路  13Comments  路  Source: valor-software/ng2-charts

ERROR NullInjectorError: StaticInjectorError(AppModule)[BaseChartDirective -> ThemeService]:
StaticInjectorError(Platform: core)[BaseChartDirective -> ThemeService]:
NullInjectorError: No provider for ThemeService!

Most helpful comment

add ThemeService in provider section in app.module.ts, this will resolve this error.

All 13 comments

I am having same issue - angular version is 8, while it works with 9

I am also having the same issue. is there any solution without updating the angular version. I am using Angular 8 & ng2-charts 2.3.2

I have the same problem

Uncaught (in promise): NullInjectorError: StaticInjectorError(AppModule)[BaseChartDirective -> ThemeService]:
StaticInjectorError(Platform: core)[BaseChartDirective -> ThemeService]:
NullInjectorError: No provider for ThemeService!
NullInjectorError: StaticInjectorError(AppModule)[BaseChartDirective -> ThemeService]:
StaticInjectorError(Platform: core)[BaseChartDirective -> ThemeService]:
NullInjectorError: No provider for ThemeService!
at NullInjector.get (http://localhost:8100/vendor.js:39072:27)
at resolveToken (http://localhost:8100/vendor.js:53990:24)
at tryResolveToken (http://localhost:8100/vendor.js:53916:16)
at StaticInjector.get (http://localhost:8100/vendor.js:53766:20)
at resolveToken (http://localhost:8100/vendor.js:53990:24)
at tryResolveToken (http://localhost:8100/vendor.js:53916:16)
at StaticInjector.get (http://localhost:8100/vendor.js:53766:20)
at resolveNgModuleDep (http://localhost:8100/vendor.js:64953:29)
at NgModuleRef_.get (http://localhost:8100/vendor.js:66019:16)
at resolveNgModuleDep (http://localhost:8100/vendor.js:64953:29)

I am at Angular 9, and get this error when building, tested both 2.4.0 and 2.4.1, had to rollback to 2.3.0:

WARNING in Invalid constructor parameter decorator in _[directory]_/node_modules/ng2-charts/fesm2015/ng2-charts.js:
() => []

ERROR in getInternalNameOfClass() called on a non-ES5 class: expected ThemeService to have an inner class declaration

add ThemeService in provider section in app.module.ts, this will resolve this error.

add ThemeService in provider section in app.module.ts, this will resolve this error.

Resolved. Thank you

add ThemeService in provider section in app.module.ts, this will resolve this error.

It works

add ThemeService in provider section in app.module.ts, this will resolve this error.

Thanks. It works

add ThemeService in provider section in app.module.ts, this will resolve this error.

what exactly should i add ?

add ThemeService in provider section in app.module.ts, this will resolve this error.

what exactly should i add ?

You have to add ThemeService in providers array in your module file. For example :

/app.module.ts/

imports : [
--------],

providers : [ThemeService]


/end of module file/

HI,
I have included Provide as mentioned above, but still getting below error:

ERROR TypeError: Cannot read property 'getColorschemesOptions' of undefined
at BaseChartDirective.getChartConfiguration (ng2-charts.js:694)
at BaseChartDirective.getChartBuilder (ng2-charts.js:711)
at BaseChartDirective.refresh (ng2-charts.js:886)
at BaseChartDirective.ngOnInit (ng2-charts.js:328)
at checkAndUpdateDirectiveInline (core.js:31910)
at checkAndUpdateNodeInline (core.js:44367)
at checkAndUpdateNode (core.js:44306)
at debugCheckAndUpdateNode (core.js:45328)
at debugCheckDirectivesFn (core.js:45271)

I have injected ThemeService in component.ts file as well

Update: Issue has been resolved.

'getColorschemesOptions'聽 this is not defined you can use hard coded聽Sent from Mail for Windows 10聽From: sharadchandraSent: Friday, September 25, 2020 10:26 AMTo: valor-software/ng2-chartsCc: navinbcs; CommentSubject: Re: [valor-software/ng2-charts] Error after updating the vesion 2.3.2 to 2.4.0 (#1255)聽HI,I have included Provide as mentioned above, but still getting below error:ERROR TypeError: Cannot read property 'getColorschemesOptions' of undefinedat BaseChartDirective.getChartConfiguration (ng2-charts.js:694)at BaseChartDirective.getChartBuilder (ng2-charts.js:711)at BaseChartDirective.refresh (ng2-charts.js:886)at BaseChartDirective.ngOnInit (ng2-charts.js:328)at checkAndUpdateDirectiveInline (core.js:31910)at checkAndUpdateNodeInline (core.js:44367)at checkAndUpdateNode (core.js:44306)at debugCheckAndUpdateNode (core.js:45328)at debugCheckDirectivesFn (core.js:45271)I have injected ThemeService in component.ts file as well鈥擸ou are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.聽

@ziqbalbh thank you! this works :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SteeledSlagle13 picture SteeledSlagle13  路  3Comments

alexcastillo picture alexcastillo  路  5Comments

dslima90 picture dslima90  路  3Comments

shenriksen4 picture shenriksen4  路  3Comments

tushartgsit picture tushartgsit  路  5Comments