Hello, I am currently learning Typescript/Angular, so please excuse me if this question has already been asked (I couldn't find it) or if it has a simple solution :)
My goal is to have a timer displayed on my webpage. I have implemented it in my component as follows:
this.secondsRemaining$ = timer(0, 1000).pipe(
map(n => 30 - n),
takeWhile(n => n >= 0 && someCondition))
);
The timer is displayed on my page using the following code:
{{ secondsRemaining$ | async }}
Once someCondition
becomes false, I want the timer to stop. How can I capture the value at which the timer stopped? Is this achievable with Observables, or should I use a different approach like BehaviorSubject?