Olloi Olloi - 1 year ago 79
AngularJS Question

Uncought Error injector::modulerr

How can i get this Error: $injector:modulerr
Module Error
by calling

angular.module('App', []).config(function () { });

The whole project worked correctly without any calls to .config(), but
i recently tried to add ng-route and got into this error even after removing any dependencies the bare config() throws the exception.

Answer Source

Try this one -

 angular.module('PtsApp', ['ngAnimate', 'angular.filter', 'ui.bootstrap', 'nvd3', 'ngRoute']) 
        .config(['$routeProvider', function ($routeProvider)  /* You wrongly spelled `routeProvider` while injecting as dependency, thats why you getting this error! */
            when('/1', { //.. }). 
            when('/2', { //... }). 
            otherwise({ redirectTo: '/' }); 

//You wrongly spelled routeProvider while injecting thats why you getting this error! Hope this help you! :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download