score:30

Accepted answer

i needed to import the chartmodule in the module.ts file of the component that i wanted to use the chart in. i originally only had it imported in app.module.ts.

score:0

for angular 7 or greater version use

npm install ng2-charts@2.2.3

--save npm install chart.js --save

score:2

in the app.module.ts file, within the ngmodule decorater there is an array called imports, mention chartsmodule in the imports array like this

imports: [browsermodule, routermodule.forroot(approutes),chartsmodule ],

it helped me. it can be helpful to you as well

score:19

try using the attribute syntax for binding:

instead of:

[data]="doughnutchartdata"

try:

attr.data="{{doughnutchartdata}}"

i'm not certain if this will work in your case, but this has to do with what's a dom property versus an attribute, and how angular handles binding for both.


Related Query

More Query from same tag