import {Component, Inject, OnInit} from '@angular/core'; import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material'; @Component({ selector: 'app-dialog', templateUrl: './dialog.component.html', }) export class DialogComponent { message = 'آیا مطمئن هستید؟'; //alert default type = 'alert'; /** * @param {MatDialogRef} dialogRef baray amaliat dialog * @param data pass kardan etelaat be dialog */ constructor(private dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) data) { if (data.message) { this.message = data.message; } if (data.type) { this.type = data.type; } } close() { this.dialogRef.close(false); } /** * برای بستن دیالوگ وقتی که requestType برابر 'yesno'بود */ no() { this.close(); } yes() { this.dialogRef.close(true); } }