Created
January 28, 2022 14:26
-
-
Save Gummiees/5901df6d781bbdc4c479c37cf1365d09 to your computer and use it in GitHub Desktop.
Display default browser popup about not saved changes when leaving the site with Angular
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* When returning false, it provokes the browser to show the popup asking if they want to leave without saving. */ | |
@HostListener('window:beforeunload', ['$event']) | |
beforeUnloadHander(event) { | |
console.log('window:beforeunload'); | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment