我正在尝试为我正在创建的angularjs
应用配置ng-token-auth,但我收到了以下错误:
Error: [$injector:modulerr] Failed to instantiate module RDash due to:
[$injector:unpr] Unknown provider: o
http://errors.angularjs.org/1.4.7/$injector/unpr?p0=o
r/<@http://localhost:8888/lib/js/main.min.js:1:381
Xe/x.$injector<@http://localhost:8888/lib/js/main.min.js:1:19793
r@http://localhost:8888/lib/js/main.min.js:1:18963
i@http://localhost:8888/lib/js/main.min.js:1:19300
r@http://localhost:8888/lib/js/main.min.js:1:18343
p/<@http://localhost:8888/lib/js/main.min.js:1:18475
o@http://localhost:8888/lib/js/main.min.js:1:786
p@http://localhost:8888/lib/js/main.min.js:1:18252
Xe@http://localhost:8888/lib/js/main.min.js:1:19942
ae/s@http://localhost:8888/lib/js/main.min.js:1:7465
ae@http://localhost:8888/lib/js/main.min.js:1:7775
oe@http://localhost:8888/lib/js/main.min.js:1:7023
@http://localhost:8888/lib/js/main.min.js:5:27591
r@http://localhost:8888/lib/js/main.min.js:3:30513
We/n@http://localhost:8888/lib/js/main.min.js:1:16341
这是我的module.js
:
angular.module('RDash', ['ui.bootstrap', 'ui.router', 'ngCookies', 'ngResource', 'ng-token-auth'])
.config(
function($authProvider) {
$authProvider.configure({
apiUrl: 'http://localhost:3000'
});
});
以下是bower.json中的依赖项:
"dependencies": {
"rdash-ui": "1.0.*",
"angular": "~1.2.21",
"angular-cookies": "~1.4.0",
"angular-bootstrap": "~0.11.0",
"angular-ui-router": "^0.2.10",
"bootstrap": "~3.2.0",
"font-awesome": "~4.1.0",
"ng-token-auth": "~0.0.28",
"ng-resource": "~0.0.2"
}
答案 0 :(得分:1)
您没有进行缩小设置。任何利用注射的东西都应该正确设置以允许这样做。你是一个未知的提供者&#34; o&#34;这是因为没有遵循以下两种方法之一。
方法1:
var controller = function($scope, $http) {
...
}
controller.$inject = ['$scope', '$http']
方法2:
app.controller("controller", ['$scope', '$http', function($scope, $http) {
...
}])
假设当你在$ authProvider中添加时会发生这种情况,我会开始寻找那里。还应检查提供程序本身中的任何关联代码。
.config(["$authProvider", function($authProvider) {
$authProvider.configure({
apiUrl: 'http://localhost:3000'
});
}]);