DEV Community

loading...

Discussion on: Where to initiate data load in NgRx

Collapse
sebasg22 profile image
Sebastián Guevara

Great post Jon, There was two ways that works for me to dispatch an action when the app starts:

@Effect()
  $init = of(new ListenAuth, asyncScheduler);
Enter fullscreen mode Exit fullscreen mode

But as Tim Descrhryver saids onInit Effects also works if you use NgRx7:

ngrxOnInitEffects(): Action {
    return { type: '[Login]: Listen Auth' };
  }
Enter fullscreen mode Exit fullscreen mode