O'Reilly logo

AngularJS by Example by Chandermani

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Request/response interceptors

Request and response interceptors, as the names suggest, can intercept HTTP requests and responses to augment/alter them. The typical use cases for using such interceptors include authentication, global error handling, manipulating HTTP headers, altering endpoint URLs, global retry logic, and some other such scenarios.

Interceptors are implemented as pipeline functions that get called one after another just like the parser and formatter pipelines for NgModelController (see the previous chapter).

Interceptions can happen at four places and hence there are four interceptor pipelines. This happens:

  • Before a request is sent.
  • After there is a request error. A request error may sound strange but, in a pipeline mode when the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required