【发布时间】:2015-03-10 20:05:35
【问题描述】:
我只是在学习角度,当我将 $locationProvider 添加到我的 .config 时,我收到以下错误。删除对 $locationProvider 的任何引用都会删除错误。这是一些角度版本错误,我尝试过不同的(更高的)版本吗?我不确定如何添加 $locationProvider 而不会出现错误。任何帮助将不胜感激。
我已经在 index.html 中设置了
Error: Error: [$injector:modulerr] http://errors.angularjs.org/1.2.9/$injector/modulerr?p0=styleApp&p1=%5B%24injector%3Anomod%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.2.9%2F%24injector%2Fnomod%3Fp0%3DstyleApp%0AF%2F%3C%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.9%2Fangular.min.js%3A6%3A449%0AVc%2Fb.
我的配置如下:
styleApp.config(function($routeProvider, $locationProvider) {
$routeProvider
// route for the home page
.when('#/', {
templateUrl : '/page/page1.html',
controller : 'mainCtrl'
})
// route for 2nd page
.when('#page2', {
templateUrl : '/subdir/page2.html',
})
// route for the 3rdpage
.when('#page3', {
templateUrl : '/subdir/page3.html',
})
.when('#page4', {
templateUrl : '/subdir/page4.html',
})
.when('#page5', {
templateUrl : '/subdirn/page5.html',
});
// use the HTML5 History API
$locationProvider.html5Mode(true);
});
【问题讨论】:
标签: angularjs angularjs-routing