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

The Solution to Error: [$injector:unpr] Unknown provider: $routeProvider is

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'});

~ Answered on 2013-10-05 13:12:28

Most Viewed Questions: