import { Component, OnInit, Inject } from '@angular/core'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; @Component({ selector: 'app-confirmation-dialog', templateUrl: './confirmation-dialog.component.html', styleUrls: ['./confirmation-dialog.component.scss'] }) export class ConfirmationDialogComponent implements OnInit { // Update view with given values title: string; message: string; constructor(public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data) { // Update view with given values this.title = data.title; this.message = data.message; } ngOnInit() { } onConfirm(): void { // Close the dialog, return true this.dialogRef.close(true); } onDismiss(): void { // Close the dialog, return false this.dialogRef.close(false); } } export class ConfirmDialogModel { constructor(public title: string, public message: any) { } }