Am trying to add a 1 minute reverse timer to verify OTP.
let timer = TimerObservable.create(1000, 1000).subscribe(t => { this.tick = t; });
Using this , it increments in ascending order. I need this to be like 1:59,1:58,1:57 …
Am trying to add a 1 minute reverse timer to verify OTP.
let timer = TimerObservable.create(1000, 1000).subscribe(t => { this.tick = t; });
Using this , it increments in ascending order. I need this to be like 1:59,1:58,1:57 …
You can do something like this:
Observable.timer(0, 1000)
.map(value => 60 - value)
.takeWhile(value => value > 0)
.subscribe(t => this.tick = t);
Thanks … This fixed the issue