Last active
February 25, 2019 10:46
-
-
Save brachi-wernick/1bf3daea02673ab1da775bc7d6a474ce to your computer and use it in GitHub Desktop.
how to register window:beforeunload event in ng5 and show browser confirmation
This file contains hidden or 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
@HostListener('window:beforeunload', ['$event']) | |
unloadNotification($event: any) { | |
if (this.hasUnsavedData()) { | |
$event.returnValue =true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment