Tudor Grigoriu Tudor Grigoriu - 5 months ago 39
AngularJS Question

Ionic + Angular Charts: Uncaught Error: Chart.js library needs to included

I am trying to include charts into my Ionic application, but I get error.
I have download the angular.js folder and chart.js folder into my lib folder and added the following lines to index.html:

<script src="lib/angular-chart.js/dist/angular-chart.js"></script>
<script src="lib/chart.js/dist/Chart.js"></script>
<script src="lib/angular-chart.js/dist/angular-chart.min.js"></script>
<script src="lib/chart.js/dist/Chart.min.js"></script>

I also added chart.js to my module: angular.module('myApp', ['ionic', 'chart.js']) but I still get the error: Uncaught Error: Chart.js library needs to included

What am I doing wrong, how can I use chart.js in my app?

Answer Source

The fix was to put before angular-chart.js as Jossef Harush implied as a comment in my post. Also it is redundant to import both ”min” and normal js files