ngrx-workshop
Search…
Table of Contents
Setup and Configuration
Rules of Thumb
Rules of Thumb pt2
NgRx Libraries
NgRx Data
NgRx Entity
Action Creators
NgRx Auto Entity
NgRx Facades
NgRx Facades
Testing
Testing Factory
Testing Reducers
Testing Selectors
Testing Effects
Advanced Actions
3 Types of Actions
Deciders
Splitter Actions
Aggregators
ToDo
Todo
Powered By
GitBook
Splitter Actions
Splits a single action in to an array of actions
Simplifies flows where multiple actions need to dispatch
1
// Effect splitter
2
@
Effect
()
3
splitter
=
this
.
actions$
.
pipe
(
4
ofType
<
LoadAdminUser
>
(
UserActionTypes
.
LoadAdminUser
),
5
flatMap
(
add
=>
[
6
new
LoadUserById
({
id
:
add
.
payload
.
id
}),
7
new
LogOperation
({
loggedAction
:
add
.
type
,
payload
:
add
.
payload
})
8
])
9
);
Copied!
Must use flatMap or NgRx will throw an error
Advanced Actions - Previous
Deciders
Next - Advanced Actions
Aggregators
Last modified
2yr ago
Copy link