How do I call a function in every 10 seconds in Angular 2?

前端 未结 4 2026
没有蜡笔的小新
没有蜡笔的小新 2021-01-14 11:23

How do I call a function in a set Time interval in Angular 2. I want it to be called/Triggered at specific time intervals(for eg 10 secs). For Eg: ts File

nu         


        
4条回答
  •  春和景丽
    2021-01-14 11:52

    You may also try the traditional setInterval function.

    setInterval(() => {
        this.callFuntionAtIntervals();
    }, 1000);
    

提交回复
热议问题