I honestly was totally lost by the documentation, and besides I was wondering the following:
If I use the
NGRX Router, will I need to use the angular's nativeapp-rounting? If so, how do I integrate theNGRX Routerwith the<router-outlet>?
Could you give me a simple example of the same?
Angular Router and NGRX router work together. Angular Router is responsible for actual routing in the application and NGRX router is responsible for getting the information out from the Angular router, following is the simple example to use navigation without NGRX.
Follow the NGRX Router documentation to setup the store.
following is the way to use Angular routing with NGRX
router.action.ts (dispatch actions from components for navigation to happen)
router.effect.ts (Effect handle the side effects, it catches the navigation action dispatch from component and does the actual routing)
NGRX provides build in Selectors to get the routing information for example queryParams, url etc.
for example you have to get the list of user by department and departmentId is in the query param of the URL
Right way to read the query param is through
selectQueryParamsselector provided by NGRX library