0
votes

Thee are many posts on this, but I cannot see what is wrong in my simple case (I am a rather noob to NgRx, so could be a simple mistake)

I have been putting together as simple a example as I can to help with another issue I am having, but I can't get my the example working, and I just cannot see what is wrong here.

The example is here.

When you click the Start polling button, the action startPolling is dispatched, but the effect in app.effects.ts...

     public startPolling$ = createEffect(() => this.actions$.pipe(
      ofType(appActions.startPolling),    
      tap(_ => console.log('app effect started polling')),  
      tap(() => this.isPollingActive = true),        
      mergeMap(() =>
        this.appDataSurvice.getData()
          .pipe(                        
            switchMap(data => {              
              return [appActions.getDataSuccess(data)
              ];
              }),
            catchError(err => of(appActions.getDataFail(err)))
          ))
    ));

Is just not being called, ie I never see the app effect started polling console log.

Can anyone see what I may be missing ?

Thanks in advance

1

1 Answers

0
votes

Found my problem...

forgot the EffectsModule.forRoot([AppEffects]) in app.module.ts