My goal is to prevent the user from navigating to any link if there are unsaved changes, and it works correctly in most cases but there are two exceptions:
- When the user clicks on "Log Out"
- When the user clicks on a toggle button at the layout level
I attempted to restrict these actions using Events, however, it seems to be deprecated.
`
@HostListener('window:beforeunload', ['$event'])
canDeactivate(): Observable<boolean> | boolean {
if(*some condition*)
{
if(event)
{
event.preventDefault();
event.stopPropagation();
}
}
return *some condition*;
}
`
All I want is to halt the request propagation