I am trying to implement lazy loading in my Angular 6 app, all of my http calls are made in the FeatureModule (lazy loaded), but still I have to add HttpClientModule in my AppModule and not in FeatureModule. Didn't really understand why.
Also, when I added interceptors in my FeatureModule, they didn't intercept any request. I have to add it in the AppModule only (I guess, it is because HttpClientModule is in AppModule).
I want to understand why this is the case?? Why can't we have HttpClientModule and HTTP_INTERCEPTORS only in the FeatureModule and not in AppModule where I am not making any http calls?
HttpClientModuleinAppModulehowever you need to immediateModulewhich usesHttp. Better to put intoSharedModuleinstead. - Sunil SinghHttpClientModulein allModuleswhich is usingHttp. - Sunil Singh