I\'m an angularjs new bee. I\'m trying to write a validation which alerts the user when he tries to close the browser window.
I have 2 links on my page v1 and v2.Whe
The code for the confirmation dialogue can be written shorter this way:
$scope.$on('$locationChangeStart', function( event ) { var answer = confirm("Are you sure you want to leave this page?") if (!answer) { event.preventDefault(); } });