Reputation: 51
I have a scenario where I need to clear all stored route handlers manually from the component, so that's why I created the following method in custom route reuse strategy and called in component
deactivateAllHandles(): void {
this.handlers = {};
}
But it's not working? any idea?
Upvotes: 1
Views: 1543
Reputation: 26190
It's hard to provide a reliable answer without seeing the code of your custom route reuse strategy class. It however typically contains a Map
that keeps track of individual paths and corresponding detached route handle as shown below.
private routeHandles = new Map<string, DetachedRouteHandle>();
If this is also the case in your custom route reuse strategy class, the clear
method could look as follows:
clear() {
this.routeHandles.clear();
}
Upvotes: 2