0
votes

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.

1
Could you paste original .config([with_dependency_inj_module],....) instead of this line config([], function () { }); ?? May be this will give clear idea what exactly you use there - Dhananjay C
And did you used angular.module('App', []) anywhere before this config file angular.module('App', []).config? - Dhananjay C
I didnt use angular.module before angular.module('App', ['ngAnimate', 'angular.filter', 'ui.bootstrap', 'nvd3', 'ngRoute']) .config(['$rootProvider', function ($routeProvider) { $routeProvider. when('/1', { //.. }). when('/2', { //... }). otherwise({ redirectTo: '/' }); }]); - Olloi

1 Answers

0
votes

Try this one -

 angular.module('App', ['ngAnimate', 'angular.filter', 'ui.bootstrap', 'nvd3', 'ngRoute']) 
        .config(['$routeProvider', function ($routeProvider) 
        { 
            $routeProvider. 
            when('/1', { //.. }). 
            when('/2', { //... }). 
            otherwise({ redirectTo: '/' }); 
        }
        ]);

//You wrongly spelled routeProvider while injecting thats why you getting this error!