Created
April 20, 2016 06:33
-
-
Save jungheelee/aa69ed30502fb768d9b60ea75e467b66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function config($stateProvider, $urlRouterProvider, $ocLazyLoadProvider, IdleProvider, KeepaliveProvider) { | |
// Configure Idle settings | |
IdleProvider.idle(5); // in seconds | |
IdleProvider.timeout(120); // in seconds | |
$urlRouterProvider.otherwise("/dashboards/dashboard_1"); | |
$stateProvider | |
.state('login', { | |
url: "/login", | |
templateUrl: "login.html", | |
controller: LoginCtrl, | |
authenticate: false | |
}) | |
.state(.......) | |
} | |
angular | |
.module('inspinia') | |
.config(config) | |
.run(function($rootScope, $state, UserService) { | |
$rootScope.authenticated = false; | |
console.dir($rootScope); | |
console.dir($state); | |
console.log(UserService); | |
$rootScope.$on("$stateChangeStart", function(event, toState, toParams, fromState, fromParams) { | |
if(toState.authenticate == true && !UserService.isLogged){ | |
$state.go("login"); | |
event.preventDefault(); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment