What is an interceptor? What are common uses of it?
An interceptor is a middleware code where all the
$http requests go through.
The interceptor is a factory that are registered in
$httpProvider. You have 2 types of requests that go through the interceptor, request and response (with
responseErrorrespectively). This piece of code is very useful for error handling, authentication or middleware in all the requests/responses.