This is the archived documentation for Angular v5. Please visit angular.io to see documentation for the current version of Angular.

RouteReuseStrategy

npm Package @angular/router
Module import { RouteReuseStrategy } from '@angular/router';
Source router/src/route_reuse_strategy.ts

Provides a way to customize when activated routes get reused.

Overview

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

Members

      
      shouldDetach(route: ActivatedRouteSnapshot): boolean
    

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


      
      store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle | null): void
    

Stores the detached route.

Storing a null value should erase the previously stored value.


      
      shouldAttach(route: ActivatedRouteSnapshot): boolean
    

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


      
      retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null
    

Retrieves the previously stored route


      
      shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean
    

Determines if a route should be reused