I am trying to use setInterval in my Angular 4 app.
const inter = setInterval(() => { // logic resulting in exitCondition if(exitCondition) { clearInt
If you want in same method with some condition
var a = 1; this.interval = setInterval(() => { console.log(a++) if(a > 30){ clearInterval(this.interval); } }, 1000);