Chartjs-Chart.js chart doesn't render when using Angular 2

1👍

I wouldn’t use Zones here but rather something like that:

export class ChartComponent implements AfterViewInit {
  @ViewChild('myChart')
  myChart:ElementRef;

  ngAfterViewInit() {
    var myChart = new Chart(this.myChart.nativeElement, {
    (...)
  }
}

And in the template:

<canvas #myChart width="400" height="400"></canvas>

This question could also help you:

Leave a comment