Is there a way to use only one instance of Angulars $timeout?
For example, there is this code:
for(i=0; i<10; i++) {
$timeout(function() {
console.log('test');
}, 2000);
}
Evaluating this code, angular will return 10 console messages after 2 seconds. Is there a way to get only one last message?
EDIT: Loop is an example, I dont know the number of cycles, I just need the last one.
Thanks