Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whats the exact difference between interceptors and transformResponse?

We can modify the data using the interceptors and the transformRequest and transformresponse.

What is then the difference except for the fact that interceptors can only be added at the global level?

Also, even the loading of the partials is a HTTP get request and the data is returned in response. How does one deal with that ?

like image 305
Bhumi Singhal Avatar asked Mar 23 '14 18:03

Bhumi Singhal


1 Answers

Differences Between Transformers and Interceptors

An interceptor can be used to intercept the request/response at various points, as discussed above. But transformers can be applied just before sending a request or after receiving a response. Another important consideration is that, using transformers, you just get access to data and headers of request/response while interceptors have access to the config object.

From AngularJS - Novice To Ninja by Sandeep Panda.

Also, I think interceptors are global while transformers can be global or per request.

like image 77
Hrodger Avatar answered Nov 13 '22 02:11

Hrodger