jtblin / angular-chart.js

Reactive, responsive, beautiful charts for AngularJS using Chart.js: http://jtblin.github.io/angular-chart.js
Other
2.67k stars 759 forks source link

chartjs-2.0 Explicit annotation for directives #308

Closed courchef closed 8 years ago

courchef commented 8 years ago

I had to modify all directives to use explicit annotation like the following example:

.directive('chartLine', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('line'); }])

instead of

.directive('chartLine', function (ChartJsFactory) { return new ChartJsFactory('line'); })

to avoid the following error:

Error: [$injector:strictdi] function(ChartJsFactory) is not using explicit annotation and cannot be invoked in strict mode

jtblin commented 8 years ago

I think maybe this was due to the fact that the dist/ files were not generated. The generated ones use explicit annotations via gulp-ng-annotate. Would you mind trying again with the angular-chart.js file from the dist/ folder in the chartjs-2.0 branch?

However this gulp-ng-annotate process seems to be confusing for users and don't really bring a lot of value so I'm considering removing it and sticking with explicit annotations like you suggest in the future.

courchef commented 8 years ago

working good now with dist/angular-chart.js.