Chartjs-Angular 6 with chart.js TypeError: item is null

0👍

Make sure to not use *ngIf, it destroys your canvas and the ElementRef. Hide it with CSS.

Also, I use getContext('2d')

<canvas #canvas>{{ chart }}</canvas>
@ViewChild('canvas') canvas: ElementRef;
this.canvas.nativeElement.getContext('2d')

Leave a comment