DEV Community

Discussion on: Where to initiate data load in NgRx

Collapse
 
iamdjarc profile image
IG:DjArc [Hey-R-C] • Edited

Hey Jon,

Thank you for this great article, I am a bit confused because of my set up, I hope you could help me understand.

In my app, I have couple modules which are using the StoreModule.forFeature flag so when I look for the "state" of those features I get a warning. telling that the state doesn't exist.

So I move the StoreModule.forFeature to the app module then it works. however the module for that feature doesn't anymore.

here is what my route looks like....

Also I am using the 'Route Guard
{
path: 'claim/:extClmId/client/:extClient/role/:roleType', canActivate: [ValidationGuard],
children: [
{ path: '', loadChildren: () => import('libs/lazy/firstview/src').then(m => m.FirstModule), canActivate: [OverviewGuard] },
{ path: 'preferences', loadChildren: () => import('@hub/lazy/preferences').then(m => m.SecondModule) },
],
},
{ path: 'error', loadChildren: () => import('@hub/lazy/four-oh-four').then(m => m.FourOhFourModule) },

OverviewGuard is what I am using to load my data but is it not the on the app.module level. it is on the FirstModule level..... Hope I am making sense.