Skip to content

Instantly share code, notes, and snippets.

@MikeRyanDev
Created February 25, 2018 21:15
Show Gist options
  • Select an option

  • Save MikeRyanDev/f3715241d86e38b1f196e10a374bddbc to your computer and use it in GitHub Desktop.

Select an option

Save MikeRyanDev/f3715241d86e38b1f196e10a374bddbc to your computer and use it in GitHub Desktop.

Revisions

  1. MikeRyanDev created this gist Feb 25, 2018.
    14 changes: 14 additions & 0 deletions map-operators-get-one-02.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    export class BookEffects {
    @Effect() getOneBook$ = this.actions$.pipe(
    // Step 1 Type: Observable<InputActionType>
    ofType(INPUT_ACTION_TYPE),
    // Step 2 Type: Observable<Observable<InputActionType>>
    groupBy(action => action.bookId),
    // Step 3 Type: Observable<Observable<BookModel>>,
    map(action$ => action$.pipe(
    exhaustMap(action => this.bookService.getOne(action.bookId),
    )),
    // Step 4 Type: Observable<BookModel>
    mergeAll(),
    );
    }