title: $http error handling in AngularJS
body: <p>$http in my AngularJS project not able to recognize 40X(401,403,405...) errors on iOS.
  I am using 1.2.10 AngularJS version and Cordova version 3.4.0.</p>
  
  <p>Below is the code I am using:</p>
  
  <pre><code>TE_SERVICES.factory('hello',function ($http,$rootScope) {
  return {
  loginUser: function(userCredentials,successCallback,errorCallback){
            $http({
                 method: "GET",
                 url: "data/example.json",
                 headers: {"Authorization":'Basic '+userCredentials},
               }).then(function(response){
                                  successCallback(response.data);
                                  console.log("Success------"+JSON.stringify(response))
               },function(data, status, headers, config){
                                  errorCallback(data);
                                  console.log("Error------"+JSON.stringify(data)+" "+status)
               })
  
          }
      }
   });
  
  hello.loginUser($rootScope.encodedUserCredencials,function(persons) {
                  // success handler
              }, function(data) {
                  // error handler
                  console.log(data.status+"===="+status)
                  });
  </code></pre>
  
  <p><code>data.status</code> is returning 0 and status returns undefined.
  Please help me to resolve this issue.</p>
  
  <p>Tried to include the domain in whitelist on IOS.But no solution :( It still gives the same response.</p>
  
  <p>But the same code works absolutely fine in Android.
  Please help me to resolve this issue.</p>
  
  <p>Thanks in advance :)</p>