Skip to content

Instantly share code, notes, and snippets.

@JosephShering
Created September 28, 2014 04:12
Show Gist options
  • Save JosephShering/fc0c7265c2b32ab83d5d to your computer and use it in GitHub Desktop.
Save JosephShering/fc0c7265c2b32ab83d5d to your computer and use it in GitHub Desktop.
.controller('CMSController', function($scope, $state, $rootScope, AuthToken) {
$scope.$on('$stateChangeStart', function(e, toState, toParams, fromState) {
var token = AuthToken.get();
if(toState != 'admin.login' && !token) {
$state.go('admin.login');
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment