When using angular's $http.head(), it returns a status. When the item does not exist, I get a 404 error in my console.
How do I catch this error and take action when the status is 200 and take no action otherwise?
This should give the functionality you are looking for:
var successCallback = function(response) {
//do your stuff when successful (status 200)
}
var errorCallback = function(response) {
//do your stuff when there is an error (400, 404 ect..)
}
$http.head('/someUrl', config).then(successCallback, errorCallback);
As far as suppressing the error itself from showing up in your console, I believe that is just a browser functionality.
.thento resolve the promise$http.head('/someUrl', config).then(successCallback, errorCallback);