ngrx effect not being called when action is dispatched from component

前端 未结 5 1820
情书的邮戳
情书的邮戳 2021-02-12 11:35

I am having an issue with the ngrx store not dispatching an action to the effect supposed to deal with it.

Here is the component that tries to dispatch:



        
5条回答
  •  攒了一身酷
    2021-02-12 11:36

    I am using a later version of ngrx (7.4.0), so cartant's suggestion of:

    .do((action) => console.log(`Received ${action.type}`))
    

    should be...

    ... = this.actions.pipe(
       tap((action) => console.log(`Received ${action.type}`)),
       ...
    

    And in the end I discovered I had missed adding my new effects export to module, like:

    EffectsModule.forRoot([AuthEffects, ViewEffects]),  // was missing the ', ViewEffects'
    

提交回复
热议问题