import { ActivatedRouteSnapshot , DetachedRouteHandle , RouteReuseStrategy } from '@angular/router' ; import { Injectable } from '@angular/core' ; /**
 * A route strategy allowing for explicit route reuse.
 * Used as a workaround for https://github.com/angular/angular/issues/18374
 * To reuse a given route, add `data: { reuse: true }` to the route definition.
 */ @ Injectable ( ) export class RouteReusableStrategy extends RouteReuseStrategy { public shouldDetach ( route ) { return false ; } public store ( route , detachedTree ) { } public shouldAttach ( route ) { return false ; } public retrieve ( route ) { return null ; } public shouldReuseRoute ( future , curr ) { return future . routeConfig === curr . routeConfig || Boolean ( future . routeConfig ?. component && future . routeConfig ?. component === curr . routeConfig ?. component ) ; } }