I'm working with angular.
I have a problem with a $timeout function. it is initiate on ng-mousedown so if I clic 2 time, it set 2 timer. That I want to avoid. How Can I delete previous timer to keep only the last one? Here the code:
$scope.stopRefresh = function() { //ng-mousedown
$interval.cancel(autoRefresh);
restartRefresh = $timeout(function(){
startRefresh();
},30000);
};
cancel()before setting the timeout$interval.cancel(autoRefresh)?