title: Angular 500 error handling doesn't work
body: <p>I have service which make post request and returns a data.</p>
  
  <pre><code>app.service('flagService', ['$http', function ($http) {
  this.getData = function (r, c) {
      return $http.post('http://localhost:8080/api/flag', { row: r, column: c }).then(function (data) {
          return data;
      })
  }
  }]);
  </code></pre>
  
  <p>And somewhere in the controller</p>
  
  <pre><code>flagService.getData(row, column).then(function () {
     console.log('it works')
  })
  </code></pre>
  
  <p>But api can also return 500 status code. In this case I get "posssible unhandled rejection..." in the console. Now I would like to make simple <code>alert()</code> which will open when 500 error is returned. I've tried many, many solutions including second function, <code>.catch()</code>, <code>.error()</code>.</p>
  
  <pre><code>app.service('flagService', ['$http', function ($http) {
  this.getData = function (r, c) {
      return $http.post('http://localhost:8080/api/flag', { row: r, column: c }).then(function (data) {
          return data;
      }, function (error) {
          console.log(error)
      }).catch(function () {console.log('error')}).error(function() {console.log('error')})
  }
  }]);
  </code></pre>
  
  <p>But I still can't hadle error. Any solution? Thanks!</p>