Skip to content

Instantly share code, notes, and snippets.

@MikeRyanDev
Created February 25, 2018 21:15
Show Gist options
  • Save MikeRyanDev/f3715241d86e38b1f196e10a374bddbc to your computer and use it in GitHub Desktop.
Save MikeRyanDev/f3715241d86e38b1f196e10a374bddbc to your computer and use it in GitHub Desktop.
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(),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment