Advertisement
Guest User

Untitled

a guest
Aug 31st, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. .run(function ($transitions, $state, AuthService) {
  2. $transitions.onStart({
  3. to: function (state) {
  4. return !!(state.data && state.data.requiredAuth);
  5. }
  6. }, function() {
  7. return AuthService
  8. .requireAuthentication()
  9. .catch(function () {
  10. return $state.target('auth.login');
  11. });
  12. });
  13. $transitions.onStart({
  14. to: 'auth.*'
  15. }, function () {
  16. if (AuthService.isAuthenticated()) {
  17. return $state.target('app');
  18. }
  19. });
  20. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement