controller:
app.run(function ($rootScope, $templateCache) {
$rootScope.$on('$viewContentLoaded', function ($scope, $http) {
$templateCache.removeAll();
alert("refresh.....");
$http({
url: '/angularjs-restful/check/check-session',
method: "POST",
data: {},
isArray: false
}).success(function(data, status, headers, config){
alert("success.....");
console.log('status: ' + status);
console.log('data: ' + data);
}).error(function(data, status, headers, config){
alert('error');
});
alert("end.....");
});
});
I need to make an AJAX call when a user hit f5 on keyboard or manually refresh the page with a mouse. How can I achieve this? the url is a rest service that either return true or false.