How to have an $http interceptor to react only to given patterns?
For instance, i would like the interceptor to handle every "/api/*" request and leave the other requests alone.
How to have an $http interceptor to react only to given patterns? For instance, i would like the interceptor to handle every "/api/*" request and leave the other requests alone. |
|||
You can filter the url in success or rejection functions both in the request or response. Lets say you need to handle the errors for requests and responses for urls which start with "math/". Here is your interceptor.
Here is your factory where you handle it
|
|||
|
config
object (docs.angularjs.org/api/ng/service/$http#usage) of therequest
and decide if it should take action or not. – Claies Oct 13 at 16:49