Created
May 6, 2020 16:37
-
-
Save adamgen/4767857f71e140f3d60c8c58a5aae307 to your computer and use it in GitHub Desktop.
NGRX | Use effects and router-store to isolate route related side π§πΌββοΈ effects - effects injectable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setCurrentCourse$ = createEffect(() => this.actions$.pipe( | |
ofType(ROUTER_NAVIGATED), // get router navigated ngrx actions | |
mergeMap(() => this.store.pipe( | |
select(selectRouteParam(βidβ))) // get the id from the router store | |
), | |
map((id: string) => setIds({ id })), // dispatch a new action to set the selected id | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment