Interceptor not working
$httpProvider.responseInterceptors
are deprecated. You can modify your code
app.factory('errorInterceptor', ['$q', '$rootScope', 'MessageService', '$location', function ($q, $rootScope, MessageService, $location) { return { request: function (config) { return config || $q.when(config); }, requestError: function(request){ return $q.reject(request); }, response: function (response) { return response || $q.when(response); }, responseError: function (response) { if (response && response.status === 404) { } if (response && response.status >= 500) { } return $q.reject(response); } };}]);app.config(['$httpProvider', function ($httpProvider) { $httpProvider.interceptors.push('errorInterceptor'); }]);
See Docs for more info