Angular HTTP Module Interceptors

I just updated the application Angular v4.2.5to Angular v4.3.6, first of all, for use Interceptors. This is a pretty awesome feature and provides a clean way to intercept HTTP calls.

However, it seems like I cannot use module level interceptors. For example, I have AppModuletwo more modules AModuleand BModule. Both AModuleand BModuleare part of AppModule.

Now, is there a way in Angular 4 where I can use module-level visibility hooks, so the hook I use for HTTP requests in AModuleshould not be used with HTTP requests in BModule. Interceptors are currently sharing all of the HTTP calls that I did not expect. I know that providersof all the modules it is combined into a parent module, but is there any way to limit such a thing?

Any help is appreciated.

+4
source share
1 answer

Add header or flag to request from different services? And then use this to determine where it is.

+3
source

Source: https://habr.com/ru/post/1684616/


All Articles