我是 AngularJS 的新手,我正在尝试创建身份验证服务,但我收到了这个错误。
Error: [$injector:modulerr] Failed to instantiate module flujoDeCaja due to:
[$injector:modulerr] Failed to instantiate module auth due to:
[$injector:nomod] Module 'auth' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
这是我的代码:
服务.js
'use strict';
var mod = angular.module('auth',['restangular']);
mod.service('AuthService', ['', function(){
var userIsAuthenticated = false;
this.setUserAuthenticated = function(value){
userIsAuthenticated = value;
};
this.getUserAuthenticated = function(){
return userIsAuthenticated;
});
}]);
应用程序.js
var angularModule = angular.module('flujoDeCaja', [
'ngCookies',
'ngResource',
'ngSanitize',
'ngRoute',
'restangular',
'auth'
]);
索引.html
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/restangular/dist/restangular.js"></script>
<script src="scripts/services/services.js"></script>
<script src="scripts/app.js"></script>
我做错了什么?
先感谢您 :)