@Input() maxSeconds = 60;
@Input() startSeconds = 0;
@Output() alarmSnooze: EventEmitter<number> = new EventEmitter<number>();
seconds: number;
private everySecond$: Observable<number> = timer(0, 1000);
private stopTimer$: Subject<{}> = new Subject();
private alarms: Array<number>;
constructor(private ref: ChangeDetectorRef) {
this.alarms = [29, 59];
}
ngOnInit() {
this.everySecond$.pipe(takeUntil(this.stopTimer$))
.subscribe((seconds) => {
this.seconds = (this.startSeconds + seconds);
if (this.alarms.includes(this.seconds)) {
this.alarmSnooze.emit(this.seconds);
}
this.ref.markForCheck();
});
}
}```
This is what i wrote as of now it just continues as seconds and keeps counting, but i want it to count to minutes.