I know how to intercept ALL requests, but I only want to intercept requests from my resources.
Does anyone know how to do this?
services.config([\'$h
The only way I know of doing this it to just filter out the requests you want in the response handler.
e.g.
...
response: function(response) {
if(response.config.url.startsWith('/api/')) {
//Do your custom processing here
}
return response;
}
...
Polyfill for string.startsWith()
//Taken from http://stackoverflow.com/questions/646628/javascript-startswith
if (typeof(String.prototype.startsWith) === 'undefined') {
String.prototype.startsWith = function(str) {
return this.slice(0, str.length) === str;
};
}