import { Component, Input, EventEmitter, Output, ViewChild, OnInit, OnChanges, SimpleChanges } from '@angular/core'; import { Notification } from '@overflow/commons-typescript/model/notification'; import { Page } from '@overflow/commons-typescript/model/commons/Page'; import { Paginator } from 'primeng/primeng'; @Component({ selector: 'of-notification-list', templateUrl: './list.component.html', }) export class NotificationListComponent implements OnChanges { @Input() notificationPage: Page; @Output() pageChange = new EventEmitter(); @Output() markAll = new EventEmitter(); @Output() select = new EventEmitter(); @ViewChild('paginator') paginator: Paginator; ngOnChanges(changes: SimpleChanges): void { if (changes['notificationPage']) { this.paginator.changePage(this.notificationPage.number); } } onPaginate(e) { this.pageChange.emit(e.page); } onRowSelect(e) { this.select.emit(e.data); } onMarkAllAsRead() { this.markAll.emit(); } }