AngularJS failed to instantiate module -
im new in angularjs , im trying create authentication service i'm getting error.
error: [$injector:modulerr] failed instantiate module flujodecaja due to: [$injector:modulerr] failed instantiate module auth due to: [$injector:nomod] module 'auth' not available! either misspelled module name or forgot load it. if registering module ensure specify dependencies second argument.
here code:
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' ]);
index.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>
what i'm doing wrong?
thank in advance :)
corrected bit believe wrong.
mod.service('authservice', [function(){ var userisauthenticated = false; this.setuserauthenticated = function(value){ userisauthenticated = value; }; this.getuserauthenticated = function(){ return userisauthenticated; }; }]);
Comments
Post a Comment