Sengi-Windows-MacOS-Linux/src/app/components/floating-column/scheduled-statuses/scheduled-statuses.componen...

30 lines
991 B
TypeScript
Raw Normal View History

import { Component, OnInit, OnDestroy } from '@angular/core';
import { Subscription } from 'rxjs';
import { ScheduledStatusService, ScheduledStatusNotification } from '../../../services/scheduled-status.service';
2019-08-25 07:43:47 +02:00
@Component({
selector: 'app-scheduled-statuses',
templateUrl: './scheduled-statuses.component.html',
styleUrls: ['./scheduled-statuses.component.scss']
2019-08-25 07:43:47 +02:00
})
export class ScheduledStatusesComponent implements OnInit, OnDestroy {
private statusSub: Subscription;
scheduledStatuses: ScheduledStatusNotification[] = [];
2019-08-25 07:43:47 +02:00
constructor(
private readonly scheduledStatusService: ScheduledStatusService) {
}
2019-08-25 07:43:47 +02:00
ngOnInit() {
this.statusSub = this.scheduledStatusService.scheduledStatuses.subscribe((value: ScheduledStatusNotification[]) => {
console.warn(value);
this.scheduledStatuses = value;
});
}
2019-08-25 07:43:47 +02:00
ngOnDestroy(): void {
if (this.statusSub) this.statusSub.unsubscribe();
}
2019-08-25 07:43:47 +02:00
}