I use the angularjs framework automatically generated by yeoman. I want to add chart elements to my single-page application. I found a solution online: angular-chart.js (http://jtblin.github.io/angular -chart.js/).
Follow the tutorial step by step and get to
angular.module('myModule', ['chart.js']);
This step got stuck. When I wrote this in the corresponding controller, I re-run the application and found that the content on the page disappeared, that is, there was no content in the p block of ng-view, but no error was reported in the console bar. I also tried writing ['chart.js'] in app.js, but it also had no effect.
After debugging, we found that after re-running the application, we checked the scope of the corresponding controller and found that the variables labels, data, etc. in the scope were all undefined, and the code did not run into the corresponding controller at all.
Put the 'chart.js' dependency in app.js
First check if all your files are imported, like
Chart.js
,angular-chart.js
. I tried it myself and it works.I am also encountering this problem now, have you solved it?