I want to execute a function before the application close. I have a code which is executing before the route changes that is fine, but I also want to execute the same function if someone close the application instead of changes the route..Is there any way?
$scope.$on('$destroy', function () {
element.autoSave();
});