When i import a module in appmodule and call forRoot everything is working no Injection problems. But when i remove from appmodule and add in a lazyloaded module calling forRoot not working as expected. Getting NullInjectorError: No provider for InjectionToken forRoot() , is it mandatory that all modules needs to be imported in appmodule. My main moto is to reduce the main.js bundle size , so don't want to load all modules in appmodule
Appmodule => featureModule.forRoot(env) => working Fine
LazyloadedModule => fetaureModule.forRoot(env) => Null Injector error