DEV Community

Discussion on: Angular: When HttpInterceptor doesn’t work with lazy loaded modules

Collapse
 
karunalakshman profile image
KarunaLakshman

Hi Abou,

I believe if you use @SkipSelf() decorator for HttpClient service in lazy module, DI mechanism will inject the HttpClient service instance from parent injector. So your interceptor in parent injector might interceptor the service calls of lazy module. please give a try. I very often use @SkipSelf to access service instance from parent injector but haven’t tried especially for HttpClient service. This might help you. Good luck!!

Collapse
 
dudumanbogdan profile image
Duduman Bogdan Vlad

Shouldn't HttpClient send same instance from CoreModule? Meaning, why is needed the SkipSelf() in lazyModule