Reputation: 13923
I'm trying with this
payloadToBeSaved$ = createEffect(() => this.actions$
.ofType(SOME_ACTION)
.withLatestFrom(this.store$)
.map(([action: Action, storeState: AppState]) => {
// Do something ...
});
But this.actions$ is an observable and I have to use this.actions$.pipe().... when I try with pipe() all lines red with errors. Don't know how to fix.
Upvotes: 1
Views: 411
Reputation: 15487
@Effect()
shipOrder = this.actions.pipe(
ofType<ShipOrder>(ActionTypes.ShipOrder),
map(action => action.payload),
concatMap(action =>
of(action).pipe(
withLatestFrom(store.pipe(select(getUserName)))
)
),
map([payload, username] => {
...
})
)
Reference: Start using ngrx/effects for this
Upvotes: 2