I would like to fire JS code in Angularjs controller.
I have this:
$scope.$on('$destroy', function () {
alert('page1');
});
This is working fine when I'm navigating away from the page which is using that controller but its not working when I'm closing tab/browser.
Do I need to use some other code to fire JS code when tab/browser is closing?
See Question&Answers more detail:os