Created
January 28, 2022 14:24
-
-
Save Gummiees/169f387accc163b5885b7a69afdd5eaa to your computer and use it in GitHub Desktop.
Detecting when the user navigates to another 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
/* This method detects when the user is leaving without prompting anything. */ | |
@HostListener('window:unload', ['$event']) | |
unloadHandler(event) { | |
console.log('window:unload'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment