Splitter Actions

  • Splits a single action in to an array of actions

  • Simplifies flows where multiple actions need to dispatch

// Effect splitter
@Effect()
splitter = this.actions$.pipe(
ofType<LoadAdminUser>(UserActionTypes.LoadAdminUser),
flatMap(add => [
new LoadUserById({ id: add.payload.id }),
new LogOperation({ loggedAction: add.type, payload: add.payload })
])
);

Must use flatMap or NgRx will throw an error