25
rated 0 times
[
29]
[
4]
/ answers: 1 / hits: 32488
/ 7 Years ago, tue, july 25, 2017, 12:00:00
I am trying to use setInterval in my Angular 4 app.
const inter = setInterval(() => {
// logic resulting in exitCondition
if(exitCondition) {
clearInterval(inter);
}
}, 1000);
This set up works fine in vanilla javascript, but clearInterval()
does not seem to work in Angular. Upon doing some research I found an interval service for Angular 1.x :
https://docs.angularjs.org/api/ng/service/$interval
Is there anything similar for Angular 4? Or is there a workaround to make clearInterval() work?
More From » angular