Patrick McDermott
Patrick McDermott

Reputation: 1220

Error: $injector:modulerr Module Error - chart.js

Trying to integrate chart.js with AngularJSbut this error is showing:

Error: $injector:modulerr Module Error. Failed to instantiate module chart.js

I know the is error is to do with where the link is declared in your header, but I have followed instructions from Angular Chart but to no avail. Any idea why this error is being thrown?

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-charts/0.2.7/angular-charts.min.js"></script>
<script src="scripts/app.js"></script>

var app = angular.module('myApp', ['ngRoute', 'angularMoment', 'ui.router', 'chart.js']);

Upvotes: 1

Views: 479

Answers (1)

Sachila Ranawaka
Sachila Ranawaka

Reputation: 41447

Name of the chart module is angularCharts. so inject it instead of the chart.js

var app = angular.module('myApp', ['ngRoute', 'angularMoment', 'ui.router', 'angularCharts']);

Upvotes: 2

Related Questions