Actually, I want to be able to handle page refreshing from AngularJS directly and not from plain JS with the following known solution:
window.onbeforeunload = function () {
// handle the exit event
};
I found that we can detect it with ngRoute by using the following event listener:
$rootScope.$on('$routeChangeStart', function (event, next, current) {
if (!current) {
// handle session start event
}
});
But I'm not using this router for my application. I am working with angular-ui-router 1.x. And events have been deprecated in favor of transitions hooks (cf. https://github.com/angular-ui/ui-router/wiki#state-change-events)
I can't find a way to detect browser refresh using angular-ui-router 1.x. If anyone have an idea to do that, it would be great !
Thanks in advance