Remove mobile-dropdown when navigation start from container.

This commit is contained in:
Konstantinos Triantafyllou 2023-07-27 10:38:41 +03:00
parent 056faac88f
commit 0a56d1fae6
1 changed files with 7 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import {Component, ElementRef, EventEmitter, Input, OnInit, Output} from "@angular/core";
import {NavigationStart, Router} from "@angular/router";
@Component({
selector: 'mobile-dropdown',
@ -20,7 +21,12 @@ export class MobileDropdownComponent implements OnInit{
public opened: boolean = false;
private static MOBILE_DROPDOWN_CONTAINER = 'mobile-dropdown-container';
constructor(private element: ElementRef) {
constructor(private element: ElementRef, private router: Router) {
this.router.events.subscribe(event => {
if(event instanceof NavigationStart) {
this.element.nativeElement.remove();
}
});
}
ngOnInit() {