ngrx-workshop
  • 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
On this page

Was this helpful?

  1. Advanced Actions

3 Types of Actions

  • Commands

  • Documents

  • Events

// Effect Action Types Example
 @Effect()
 insert: Observable<Action> = this.actions$.pipe(
   ofType<InsertUser>(UserActionTypes.InsertUser), // command
   exhaustMap(action =>
     this.service.create(action.payload.user).pipe(
       map((user: User) => new InsertUserSuccess({ result: user })), // document
       catchError(() => of(new UserActionFail(
		{ error: 'Error inserting user.' }))) // event
     )
   )
 );
PreviousTesting EffectsNextDeciders

Last updated 5 years ago

Was this helpful?