import { RouterStateSerializer } from '@ngrx/router-store' ; import { RouterStateSnapshot } from '@angular/router' ; interface MyState { url : string ; queryParams ; params ; } export class MySerializer implements RouterStateSerializer < MyState > { serialize ( routerState ) { console . log ( 'serializer' ) ; console . log ( 'complete router state' , routerState ) ; const { url , root : { queryParams } } = routerState ; const state = { url , queryParams , params : { } } ; if ( routerState . root . firstChild ) { const { root : { firstChild : { params } } } = routerState ; state . params = params ; } return state ; } }