Http Interceptor

Download angular2 eBook


What we do with HttpServiceLayer class is extend the Http class from angular and add our own logic to it.

We then inject that class in the bootstrap class of the application and tell angular that were we import the Http class, in the back to insert the HttpServiceLayer.

Anywhere in the code we can simply import

import { Http } from '@angular/http';

But our class will be used for each call.

Related Examples


384 Contributors: 7
Monday, July 31, 2017
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial:

Download eBook