Issue
Thee are many posts on this, but I cannot see what is wrong in my simple case (I am a rather new 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. What might I be missing?
Solution
Found my problem...
forgot the EffectsModule.forRoot([AppEffects]) in app.module.ts
Answered By - peterc
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.