我有一个计时器:Angular2可观察定时器条件
initiateTimer() {
if (this.timerSub)
this.destroyTimer();
let timer = TimerObservable.create(0, 1000);
this.timerSub = timer.subscribe(t => {
this.secondTicks = t
});
}
我怎么会弹出一个用户当前60分钟后加入的条件?我试过看几个问题(this和this),但它不是为我点击。 RxJS模式还是新的...
您还需要退订。最好在ngOnInit()中放置上面的代码,并在ngOnDestroy()中取消订阅 – user2960993