import { ActivatedRouteSnapshot , DetachedRouteHandle } from '@angular/router' ; import { BaseRouteReuseStrategy } from './base-route-reuse-strategy.service' ; export class CurtomRouteReuseStrategy extends BaseRouteReuseStrategy { private storedRoutes = new Map < string , DetachedRouteHandle > ( ) ; shouldDetach ( route ) { return route . routeConfig ! . path === 'list' ; } store ( route , handle ) { this . storedRoutes . set ( route . routeConfig ! . path ! , handle ) ; } shouldAttach ( route ) { return ! ! this . storedRoutes . get ( route . routeConfig ! . path ! ) ; } retrieve ( route ) { return this . storedRoutes . get ( route . routeConfig ! . path ! ) as DetachedRouteHandle ; } }