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 | null): 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

参数

route

Type: ActivatedRouteSnapshot.

返回值

boolean

Stores the detached route.

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

参数

route

Type: ActivatedRouteSnapshot.

handle

Type: DetachedRouteHandle | null.

返回值

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

参数

route

Type: ActivatedRouteSnapshot.

返回值

boolean

Retrieves the previously stored route

abstract retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null

参数

route

Type: ActivatedRouteSnapshot.

返回值

DetachedRouteHandle | null

Determines if a route should be reused

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

参数

future

Type: ActivatedRouteSnapshot.

curr

Type: ActivatedRouteSnapshot.

返回值

boolean