import { Injectable } from '@angular/core' ; import { RouterStateSnapshot , Params } from '@angular/router' ; import { RouterStateSerializer } from '@ngrx/router-store' ; export interface RouterStateUrl { url : string ; params : Params ; queryParams : Params ; } /**
 * Naive custom router state serializer that doesn't account for auxiliary router outlets.
 */ @ Injectable ( ) export class RouterStateSerializerService implements RouterStateSerializer < RouterStateUrl > { serialize ( routerState ) { let route = routerState . root ; while ( route . firstChild ) { route = route . firstChild ; } const { url , root : { queryParams } } = routerState ; const { params } = route ; return { url , params , queryParams } ; } }