角度:当计数器变量值为0时调用方法

时间:2018-10-17 15:06:35

标签: angular setinterval angular-directive

我在Angular的构造函数中运行setInterval,每秒使变量值减少1:

setInterval(() => 
   this.counter = this.counter - 1
    , 1000);

this.counter = 0时,我想在当前组件中调用一个方法。是否有任何角度指令会基于某个变量值运行方法?

0 个答案:

没有答案