I have two modules, let's call them EagerModule
and PrealodedModule
. Both of them have their own feature reducers and effects.
EagerModule
is loaded eagerly in the app, meaning its in the list of AppModule
's imports.
@NgModule({
imports: [
// .. other modules
EagerModule
]
PreloadedModule
, on the other hand, is loaded lazily, but since I am using preloadingStrategy: PreloadAllModules
, we can say that it's basically preloaded (meaning, it's being loaded just after all eager modules are loaded).
I am trying to dispatch an action from PrealoadedModule
in a EagerModule
's component. However, it seems like the effects are not being initialized as my action doesn't perform the http request that it is supposed to. I tried hacking this by only dispatching this action after I have a value in PreloadedModule
's state selector, however, this didn't work either.
The only way I can get this working is if I load PreloadedModule
eagerly, but that is not what I want to achieve.
So, how can I make effects from a preloaded module work in another module?
AppModule
it isEffectsModule.forRoot(effects)
, and in all feature module it goes likeEffectsModule.forFeature(effects)
– Aurify