title: AngularJS $http, error handling, interceptors and response status code 0
body: <p>I expected that bad requests would fall in the function defined inside $http#error, but that does not happen. Instead I had to create an interceptor. And even though I know the status code should be 404, the returned status code in the response is 0.</p>
  
  <pre><code> $http({url: "myurl", method: "GET"}).success(
     function(data, status, headers, config) {
       if (data.ret_code === 200) {
          //do something
       }
     }).error(function(data, status, headers, config) {
       //NEVER GETS HERE ON BAD REQUEST!!
     });
  </code></pre>
  
  <p>and here is the interceptor:</p>
  
  <pre><code>var interceptor = ['$q', function ($q) {
  
    function success(response) {
      return response;
    }
  
    function error(response) {
      //ALWAYS 0!
      var status = response.status;
  
      return $q.reject(response);
    }
  
    return function (promise) {
      return promise.then(success, error);
    }
  }];
  </code></pre>
  
  <p>1-Why is this?
  2-Is there a way to catch bad requests in $http#error?
  3-Is there a way to get the actual 404 status code?</p>