Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (47.6k points)

When using angular 1.2 instead of 1.07 the following piece of code is not valid anymore, why?

'use strict'; 

var app = angular.module('myapp', []); app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { $locationProvider.html5Mode(true); 

$routeProvider. 

when('/', { 

templateUrl: 'part.html', 

controller: 'MyCtrl' 

}). 

otherwise({ 

redirectTo: '/' 

  }); 

  }

]);

the issue is in the injector configuration part (app.config):

Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.0rc1/$injector/modulerr?p0=muninn&p1=Error%…eapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.0rc1%2Fangular.min.js%3A31%3A252)

If I remember correctly this issue started with angular 1.1.6.

1 Answer

0 votes
by (106k points)
edited by

The reason why using angular 1.2 instead of 1.07 the following piece of code is not valid anymore is that a noob error can be forgetting to include the module js see a below-mentioned piece of code that tells how to remove that error:-

<script src="app/modules/myModule.js"></script>

All files will be in the index.html.

Want to become an Angular expert? Join this Angular Course now!

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...