Angular.js $http intercept "net::ERR_CONNECTION_REFUSED" Angular.js $http intercept "net::ERR_CONNECTION_REFUSED" angularjs angularjs

Angular.js $http intercept "net::ERR_CONNECTION_REFUSED"


You can probably check the status of the ResponseError. When an API is offline that is 0 (until Angular 1.3.18) or -1 (since Angular 1.3.19):

angular.module("services.interceptor", arguments).config(function($httpProvider) {     $httpProvider.interceptors.push(function($q) {        return {          responseError: function(rejection) {                if(rejection.status <= 0) {                    window.location = "noresponse.html";                    return;                }                return $q.reject(rejection);            }        };    });});