I am using $resource
in Angular js. I want to configure $resource
using $resourceProvider
in such a way that I can handle the server response.
For Example
I am doing a get
request for user profile and if I get 500
error from server I should give an alert("Something went wrong at server");
and if I get 403
I should give alert("You don't have permission to access this resource");
How can I achieve this?
I have done some other configuration like this:
$resourceProvider.defaults.actions.update = {
method: 'PUT'
};
This works fine the same way I want to achieve this goal.
Thanks.