Tuesday, May 26, 2015

Error: [$injector:unpr] Unknown provider: $routeProvider

http://stackoverflow.com/questions/19197182/error-injectorunpr-unknown-provider-routeprovider?rq=1


It looks like you forgot to include the ngRoute module in your dependency for myApp.
In Angular 1.2, they've made ngRoute optional (so you can use third-party route providers, etc.) and you have to explicitly depend on it in modules, along with including the separate file.
'use strict';

angular.module('myApp', ['ngRoute']).
    config(['$routeProvider', function($routeProvider) {
$routeProvider.otherwise({redirectTo: '/home'});
}]);

No comments:

Post a Comment