My factory looks like:
'use strict';
angular.module('myApp')
.factory('httpInterceptor',['$q','$location', '$rootScope', function($q, $location, $rootScope){
return {
response: function(response) {
if(response.success === false) {
console.log("Redirecting");
$location.path('/login');
return $q.reject(response);
}
return response || $q.when(response);
}
}
}]);
It spits out the log, but doesn't change the path. What can I do to make this happen?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…