Im building an Angular application and having some troubles with closing the menu on popstate. when the side menu is open and the user clicked on the back button on his mobile device i want the menu to close the menu, for that im using pop state like that
@HostListener('window:popstate', ['$event'])
onPopState(event) {
if (this.isMenuOpened) {
this.toggleSidebar();
}
return ;
}
The problem Im having is that the back action also works, so the menu is close but the back action is also happens.
i cant use history.go(1)
because it makes the page load again and i don't want this kind of behaviour.
did you have any ideas ?