BaseRouteReuseStrategy
class
This base route reuse strategy only reuses routes when the matched router configs are identical. This prevents components from being destroyed and recreated when just the fragment or query parameters change (that is, the existing component is reused).
abstract class BaseRouteReuseStrategy implements RouteReuseStrategy { shouldDetach(route: ActivatedRouteSnapshot): boolean store(route: ActivatedRouteSnapshot, detachedTree: DetachedRouteHandle): void shouldAttach(route: ActivatedRouteSnapshot): boolean retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean }
Description
This strategy does not store any routes for later reuse.
Angular uses this strategy by default.
It can be used as a base class for custom route reuse strategies, i.e. you can create your own class that extends the BaseRouteReuseStrategy
one.
Methods
shouldDetach() | |||
---|---|---|---|
Whether the given route should detach for later reuse. Always returns false for | |||
|
route | ActivatedRouteSnapshot |
Returns
boolean
store() | ||||||
---|---|---|---|---|---|---|
A no-op; the route is never stored since this strategy never detaches routes for later re-use. | ||||||
|
route | ActivatedRouteSnapshot | |
detachedTree | DetachedRouteHandle |
Returns
void
shouldAttach() | |||
---|---|---|---|
Returns | |||
|
route | ActivatedRouteSnapshot |
Returns
boolean
retrieve() | |||
---|---|---|---|
Returns | |||
|
route | ActivatedRouteSnapshot |
Returns
DetachedRouteHandle | null
shouldReuseRoute() | ||||||
---|---|---|---|---|---|---|
Determines if a route should be reused. This strategy returns | ||||||
|
future | ActivatedRouteSnapshot | |
curr | ActivatedRouteSnapshot |
Returns
boolean
© 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v10.angular.io/api/router/BaseRouteReuseStrategy