Problem with import a graph in a canvas-element


I want to integrate a line graph within a canvas element on a page (with Chart.js).
But I’m always getting " TypeError: Cannot call method ‘getContext’ of null ". It seems that the problem is that Chart.js is loaded before the canvas-element (I’m loading it in the index.html).
Is there a opportunity to load after the canvas-element on a page or another way to get this work? (loading it in the end of my graphside.html, which should contain the graph even doesn’t work at all.)

Thank you!


There’s always $timeout. Not sure if that is the right way to handle it though.


Found the solution here: Angular-charts inside ionic
With angles.js it works like a charm.