Is there a way to verify if a resource failed to be fetched in AngularJS?
For instance:
//this is valid syntax
$scope.word = Word.get({ id : $routeParams.id },function() {
//this is valid, but won't be triggered if the HTTP response is 404 or any other http-error code
});
//this is something similar to what I want
//(PLEASE NOTE THAT THIS IS INVALID AND DOES NOT EXIST)
$scope.word = Word.get({ id : $routeParams.id },{
success : function() {
//success
},
failure : function() {
//404 or error
}
});
Any thoughts on how to achieve this?