Gianluca Ghettini Gianluca Ghettini - 7 months ago 15
Javascript Question

$Http.get(), how to deal with 404 response from WebAPI

On my web application I perform a

command to a remote HTTP WebAPI service

$http.get(url).then(function(data) { do_something(); });

everything works fine when the WebAPI returns some data, however the function doesn't seem to trigger when the WebAPI return a 404 error (no data to display).
How can I set a callback for it?

$http.get(url).then(function(data) {
}, function(err) {
  // your error function