1234567891011121314151617181920212223242526272829303132333435363738394041 |
- 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<DialogComponent>} dialogRef baray amaliat dialog
- * @param data pass kardan etelaat be dialog
- */
- constructor(private dialogRef: MatDialogRef<DialogComponent>, @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);
- }
- }
|