I received this error upon upgrading from AngularJS 1.0.7 to 1.2.0rc1.
Javascript – Failed to instantiate module [$injector:unpr] Unknown provider: $routeProvider
angularjsjavascriptroutes
Related Topic
- Javascript – How to correctly clone a JavaScript object
- Javascript – the JavaScript version of sleep()
- Javascript – What does “use strict” do in JavaScript, and what is the reasoning behind it
- Javascript – event.preventDefault() vs. return false
- Javascript – Why does Google prepend while(1); to their JSON responses
- Javascript – How does data binding work in AngularJS
- Angularjs – the difference between ‘@’ and ‘=’ in directive scope in AngularJS
- Javascript – Why does the JavaScript code receive a “No ‘Access-Control-Allow-Origin’ header is present on the requested resource” error, while Postman does not
Best Answer
The ngRoute module is no longer part of the core
angular.js
file. If you are continuing to use $routeProvider then you will now need to includeangular-route.js
in your HTML:API Reference
You also have to add
ngRoute
as a dependency for your application:If instead you are planning on using
angular-ui-router
or the like then just remove the$routeProvider
dependency from your module.config()
and substitute it with the relevant provider of choice (e.g.$stateProvider
). You would then use theui.router
dependency: