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
}
    

方法

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

abstract shouldDetach(route: ActivatedRouteSnapshot): boolean
      
      abstract shouldDetach(route: ActivatedRouteSnapshot): boolean
    
参数
route ActivatedRouteSnapshot
返回值

boolean

Stores the detached route.

abstract store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle): void
      
      abstract store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle): void
    
参数
route ActivatedRouteSnapshot
handle DetachedRouteHandle
返回值

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
    
参数
route ActivatedRouteSnapshot
返回值

boolean

Retrieves the previously stored route

abstract retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null
      
      abstract retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null
    
参数
route ActivatedRouteSnapshot
返回值

DetachedRouteHandle | null

Determines if a route should be reused

abstract shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean
      
      abstract shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean
    
参数
future ActivatedRouteSnapshot
curr ActivatedRouteSnapshot
返回值

boolean