| Start |
|---|
| Using our class instead of Angular's Http After extending the Http class, we need to tell angular to use this class instead of Http class. In order to do this, in our main module(or depending on the needs, just a particular module), we need to write in the providers section: Note: ApplicationConfiguration is just a service I use to hold some values for the duration of the application |
Simple Class Extending angular's Http class |
Simple HttpClient AuthToken Interceptor (Angular 4.3+) Providing Interceptor (some-module.module.ts) RemarksWhat 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 But our class will be used for each call. |
Read Article
https://develop.horje.com/learn/1434/reference