0

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.

これが私のコードです:

Service.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;
    });

}]);

App.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>

私が間違っていることは何ですか?

前もって感謝します :)

4

1 に答える 1

1

間違っていると思われる部分を修正しました。

mod.service('AuthService', [function(){

    var userIsAuthenticated = false;

    this.setUserAuthenticated = function(value){
        userIsAuthenticated = value;
    };

    this.getUserAuthenticated = function(){
        return userIsAuthenticated;
    };

}]);
于 2014-03-11T21:29:03.657 に答える