Last active
December 29, 2018 15:45
-
-
Save nathan-lapinski/4a7440f2df7f55ddee6b153bee906100 to your computer and use it in GitHub Desktop.
The router's default reuse strategy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Does not detach any subtrees. Reuses routes as long as their route config is the same. | |
*/ | |
export class DefaultRouteReuseStrategy implements RouteReuseStrategy { | |
shouldDetach(route: ActivatedRouteSnapshot): boolean { return false; } | |
store(route: ActivatedRouteSnapshot, detachedTree: DetachedRouteHandle): void {} | |
shouldAttach(route: ActivatedRouteSnapshot): boolean { return false; } | |
retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle|null { return null; } | |
shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean { | |
return future.routeConfig === curr.routeConfig; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment