From the course: Learning NgRx

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

The NgRx router store

The NgRx router store - Angular Tutorial

From the course: Learning NgRx

Start my 1-month free trial

The NgRx router store

- [Lecturer] In this video we are going to see how to use NgRx with angular router. So by now you have a pretty good idea on how to manage your application state through actions, reducers and effects. So next thing I want to show you is how to handle the angular component router through NgRx, so that the current route is actually part of your NgRx state, and we can react to route changes using effects or even prevent navigation from happening using effects as well. So the first thing we want to do is to have the router store in place because that's an optional package with NgRx. So we're going to install it through a regular NPM install, so I'm opening my terminal here and running NPM install @ngrx/router-store and we're going to save it as always. So now that we have this package installed, we can add it to the state of our application. So I'm navigating to the index.ts file where we have all of our reducers and I'm going to add a new reducer which is going to be the router store…

Contents