[Chartjs]-Chart.js chart does not display when inside an ngIf.

5๐Ÿ‘

โœ…

#myChart is not present in the DOM when youโ€™re trying to initialize the chart. Try with ng-show instead of ng-if.

Anyhow, it loook like youโ€™re not initializing the chart from the controller once the data is populated, like you should do.

Hope it helps.

0๐Ÿ‘

you have to create the Chart object only after the div is created, so call the function that create the Chart on the same place where you change the chartData.length instead of calling it right after the component is created

Leave a comment