remove tooltips on route reuse

This commit is contained in:
Dan Percic 2021-06-15 12:48:45 +03:00
parent d744eab962
commit 293d417abb

View File

@ -17,12 +17,19 @@ interface RouteStorageObject {
export class CustomRouteReuseStrategy implements RouteReuseStrategy {
private _storedRoutes: { [key: string]: RouteStorageObject } = {};
private static _removeTooltips(): void {
while (document.getElementsByTagName('mat-tooltip-component').length > 0) {
document.getElementsByTagName('mat-tooltip-component')[0].remove();
}
}
shouldDetach(route: ActivatedRouteSnapshot): boolean {
return !!route.routeConfig.data?.reuse && !!this._getKey(route);
}
store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle): void {
if (handle === null) return;
CustomRouteReuseStrategy._removeTooltips();
const element: any = handle;