Help Angular by taking a 1 minute survey!Go to surveyHome

RouteReuseStrategy

Provides a way to customize when activated routes get reused.

      
      abstract class RouteReuseStrategy {
  abstract shouldDetach(route: ActivatedRouteSnapshot): boolean
  abstract store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle): void
  abstract shouldAttach(route: ActivatedRouteSnapshot): boolean
  abstract retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null
  abstract shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean
}
    

Methods

Determines if this route (and its subtree) should be detached to be reused later

abstract shouldDetach(route: ActivatedRouteSnapshot): boolean
      
      abstract shouldDetach(route: ActivatedRouteSnapshot): boolean
    
Parameters
route ActivatedRouteSnapshot
Returns

boolean

Stores the detached route.

abstract store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle): void
      
      abstract store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle): void
    
Parameters
route ActivatedRouteSnapshot
handle DetachedRouteHandle
Returns

void

Storing a null value should erase the previously stored value.

Determines if this route (and its subtree) should be reattached

abstract shouldAttach(route: ActivatedRouteSnapshot): boolean
      
      abstract shouldAttach(route: ActivatedRouteSnapshot): boolean
    
Parameters
route ActivatedRouteSnapshot
Returns

boolean

Retrieves the previously stored route

abstract retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null
      
      abstract retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null
    
Parameters
route ActivatedRouteSnapshot
Returns

DetachedRouteHandle | null

Determines if a route should be reused

abstract shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean
      
      abstract shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean
    
Parameters
future ActivatedRouteSnapshot
curr ActivatedRouteSnapshot
Returns

boolean