title: $http.error promise seems to be not firing in angularjs
body: <p>I am following along the sportsStore example from the Pro AngularJS book by Adam Freeman and seem to be stuck in a code example on chapter 7.</p>
  
  <p>Adam uses the data.error property within the main app.html from the controller listed below, I am forcing an error by providing an invalid url, but I don't think the $scope.data.error property is getting populated:</p>
  
  <pre><code>angular.module("sportsStore")
  .constant("dataUrl", "http://localhost:5500/xxx")
  .controller("sportsStoreCtrl", function($scope, $http, dataUrl){
  
  $scope.data = {};
      $http.get(dataUrl)
          .success(function(data){
             $scope.data.products = data; 
          })
          .error(function(error){
              $scope.data.error = error;
          });
  });
  </code></pre>
  
  <p>In the app.html, the data.error field is used as a boolean</p>
  
  <pre><code>&lt;div class="alert alert-danger" ng-show="data.error"&gt;
      Error ({{data.error.status}}). The product data was not loaded.
      &lt;a href="/app.html" class="alert-link"&gt;Click here to try again&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>However, the data.error field doesn't populate anything. Replacing the 'data.error' with a 'true' gives me a correct result.</p>
  
  <p>Batarang shows no such error property.</p>
  
  <p><a href="https://i.stack.imgur.com/LNdQu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LNdQu.png" alt="enter image description here"></a></p>