import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
@Component({
selector: 'app-events-dialog',
template: `
{{target}} events
ALL
{{event}}
`,
styles: [
'mat-dialog-content { display: inline; }',
'mat-divider { margin-top: 5px; margin-bottom: 5px }'
]
})
export class EventsDialogComponent {
target = '';
checkAll = true;
eventCollection: any = {};
constructor(public dialogRef: MatDialogRef,
@Inject(MAT_DIALOG_DATA) public data) {
this.target = data.target;
this.eventCollection = data.eventCollection;
}
updateAll() {
Object.keys(this.eventCollection).forEach(key => {
this.eventCollection[key] = this.checkAll;
});
}
eventNamesArray(): String[] {
return Object.keys(this.eventCollection);
}
}