1
votes

Just added angular-chartist to my app and am now getting the following error:

Failed to instantiate module routerApp due to:
Error: [$injector:modulerr] http://errors.angularjs.org/1.3.14/$injector/modulerr?p0=...)
    at Error (native)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:6:417
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:35:320
    at s (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:7:302)
    at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:34:399)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:35:63
    at s (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:7:302)
    at g (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:34:399)
    at ab (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:38:135)
    at d (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js:17:381

I think this error occurs when I define the angular app:

//define Angular app
var routerApp = angular.module("routerApp", ["ui.router", "angular-chartist"]);

Did I set up something incorrectly?

The following code also deals angular-chartist:

//draw chart
var drawChart = function(results) {
    var data = {
        labels: [],
        series: []
    }

    for (var i = 0; i < results.length; i++) {
        data.labels.push(results[i].trait);
        data.series.push(results[i].normalized);
    }

    new Chartist.Bar('.ct-chart ct-perfect-fourth', data);

};

You can find docs for angular-chartist here

1
are you sure you included all the script tags for the chartist.js and the angular ui router js file? - clintsmith
@csmithmaui, I think i do; what would be the correct order? - Carriemf
I'm not sure it matters but I would probably declare angular UI Router JS file first. I would probably try commenting out the the chartist injection and references in your controller and see if the error still occurs. That might help you to see if the error is coming from the the chartist stuff or the ui-router stuff. For more help you might post more of your html and js. - clintsmith
I had to move the dists out of node_modules into another file. - Carriemf

1 Answers

1
votes

Make sure you also include chartist.js in your index.html, anywhere before angular-chartist:

<script type="text/javascript" src="bower_components/chartist/dist/chartist.min.js"></script>