我正在打印一个倒数计时器,我需要几分钟:秒格式。我用{{this.countDown |来打印它async}}
这个数字打印得很好,直到第二个60格式为1:00 ....当计时器到达59时,它应该改变格式并在地图中输入else条件,但数字消失,似乎是什么问题。我总是尝试做return this.count%60;
或返回${this.count%60};
(由于一些奇怪的原因,这给了$ $)。我怎样才能做到这一点?谢谢!!
this.millisecondsTillNextClickSubscription = this.contributorManagerService.timeRemainingTillNextClick.subscribe(newMillisecondsRemainingTillNextClick =>{
console.log("Receiving timer, cause details component",newMillisecondsRemainingTillNextClick);
this.count = newMillisecondsRemainingTillNextClick;
this.countDown = Observable.timer(0,1000)
.take(this.count)
.map(()=>{ --this.count;
if(this.count > 59){
return `${Math.floor(this.count/60)}:${this.count%60<10?"0"+this.count%60:this.count%60;}`}
else {
return ""+this.count%60;
}
});
});