Nhà máy của tôi trông giống như:
'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);
}
}
}]);
Nó spits ra nhật ký, nhưng không thay đổi đường dẫn. Tôi có thể làm gì để thực hiện điều này?
Câu hỏi liên quan: http://stackoverflow.com/questions/25579938/location-path-not-working-from-http-interceptor/ – Sirozha