我将代码编写为我的角度控制器,如下所示:
.config(function($routeProvider, $locationProvider, $httpProvider) ,
但我总是得到这个错误:
angular.js:9193 Error: [$injector:unpr] Unknown provider: locationProvider <- location <- activeNavDirectivehttp://errors.angularjs.org/1.2.3/$injector/unpr?p0=locationProvider%20%3C-%20location%20%3C-%20activeNavDirective at
/js/bower_components/angular/angular.js:78:12 at
/js/bower_components/angular/angular.js:3473:19 at Object.getService [as get]
/js/bower_components/angular/angular.js:3600:39) at
/js/bower_components/angular/angular.js:3478:45 at getService
/js/bower_components/angular/angular.js:3600:39) at Object.invoke
/js/bower_components/angular/angular.js:3622:13) at
/js/bower_components/angular/angular.js:5146:43 at Array.forEach (native) at forEach
/js/bower_components/angular/angular.js:300:11) at Object.<anonymous>
(xxxxx/js/bower_components/angular/angular.js:5144:13)angular.js:9193 (anonymous function)
答案 0 :(得分:5)
在某些地方您使用的$locationProvider
没有$
前缀locationProvider
。你能查一下吗?