如何獲得多少次這種觀測的跑如何獲得蜱的數量從rxjs可觀察
this.clock = Observable.interval(1000).map(function(value){
if(value == 0){
return value * 100/60;
}
return value * 100/60;
}).take(61);
我想,這可觀測跑1或2或3次..並顯示與插補每次在模板
,如果我這樣做,它會返回百分比變量是NaN的
this.clock.subscribe(function(x){
console.log(x);
console.log("percentage " + this.percentage);
this.percentage = this.percentage + 1;
})
'如果你不初始設置'this.percentage = 0' this.percentage'返回NaN。這是因爲'undefined + anyNumber = NaN' – adriancarriger
謝謝你,很好的信息 – blackHawk