I have a function like this one:
module.exports.getMyItems = ['$rootScope', '$resource', function getMyItems($rootScope, $resource) {
return $resource('/myEndpoint/:id',
{id : '@id'},
{
query: {
method: 'GET',
isArray: true
}
});
}];
I want to emit an event like
$rootScope.$emit('ITEMS_LOADING');
how can I add a callback to emit this event when the resource is loaded?
how can I add a callback to emit this event when the resource is loaded?
One can add a response interceptor:
For more information, see