angularjs - Call Angular Controller function on application Close -


i want execute function before application close. have code executing before route changes fine, want execute same function if close application instead of changes route..is there way?

 $scope.$on('$destroy', function () {                  element.autosave();              }); 

the "onbeforeunload" event fires before window starts unloading resources. more info here: mdn onbeforeunload

beware of on handler, browser not complete, example, ajax request before unloading.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -