Inside of an angular controller I'm trying to stop an interval. Is it not possible to stop the interval if there is a .then promise chained to it?
Why does the stopCount function work here
var stop = $interval(function(){
console.log('testing interval');
}, 1000);
$scope.stopCount = function(){
$interval.cancel(stop);
}
but not here with the .then
var stop = $interval(function(){
console.log('testing interval');
}, 1000)
.then(function(){
console.log('complete')
});
$scope.stopCount = function(){
$interval.cancel(stop);
}
Thanks in advance!