Skip to content

Instantly share code, notes, and snippets.

@merkurii
Created October 8, 2013 11:11
Show Gist options
  • Select an option

  • Save merkurii/6883100 to your computer and use it in GitHub Desktop.

Select an option

Save merkurii/6883100 to your computer and use it in GitHub Desktop.
app.run(function ($rootScope, $location, CurrentUser) {
$rootScope.$on('$stateChangeStart', function (event, next, current) {
if (($location.url() != '/security/login' || $location.url() != '/security/signup') && !CurrentUser.isLoggedIn()) {
$location.path('/security/login');
}
if (($location.url() == '/security/login' || $location.url() == '/security/signup') && CurrentUser.isLoggedIn()) {
$location.path('/diary/profile');
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment