Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Create an http interceptor that handles a 302 redirect to the login page when automatically logged out
  2.   $httpProvider.interceptors.push(function($q, $location){
  3.       return {
  4.           'response': function(response) {
  5.               if(response.data.indexOf('<title>Login</title>') != -1)
  6.               {
  7.                   $location.url('/logout'); //problem: this redirects to 'http://host/myApp/#/logout, not 'http://host/logout'
  8.               }
  9.               return response || $q.when(response);
  10.           }
  11.       };
  12.   });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement