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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…