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

前端 未结 2 427
一向
一向 2020-12-24 00:29

I am trying to get an AngularJS 1.2 RC2 app up and running. Currently, I\'ve been using the Angular Seed project to try and get my app up and running. Unfortunately, the Ang

2条回答
  •  忘掉有多难
    2020-12-24 00:55

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

提交回复
热议问题