Page MenuHomec4science

dialog.component.ts
No OneTemporary

File Metadata

Created
Wed, Jun 12, 18:30

dialog.component.ts

import {Component, Inject, Injectable} from '@angular/core';
import { MatDialogRef, MatIconModule, MAT_DIALOG_DATA } from '@angular/material';
@Component({
selector: 'dialog-component',
templateUrl: './dialog.component.html',
styleUrls: ['./dialog.component.css']
})
@Injectable()
export class DialogComponent {
// DEFAULT values in case there is no initialContent or button text passed from app
initialContent = 'Loading data for entity ...';
cancelButtonText = 'close';
constructor(
@Inject(MAT_DIALOG_DATA) private data: any,
private dialogRef: MatDialogRef<DialogComponent>) {
//
// in case there is no data/initialContent passed the default this.initialContent will be displayed- Same for button text.
//
if (data) {
this.initialContent = data.message || this.initialContent;
if (data.buttonText) {
this.cancelButtonText = data.buttonText.cancel || this.cancelButtonText;
}
}
this.dialogRef.updateSize('1200vw', '800vw');
}
onConfirmClick(): void {
this.dialogRef.close(true);
}
}

Event Timeline