34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
import { Component, Inject } from '@angular/core';
|
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
|
import { AngularMaterialModule } from '../../module/angular-material.module';
|
|
|
|
@Component({
|
|
selector: 'app-confirm-dialog',
|
|
imports: [AngularMaterialModule],
|
|
template: `
|
|
<h2 mat-dialog-title>{{ data.title }}</h2>
|
|
<mat-dialog-content>{{ data.message }}</mat-dialog-content>
|
|
<mat-dialog-actions align="end">
|
|
<button mat-raised-button color="warn" [mat-dialog-close]="true">
|
|
{{ data.confirmText || 'Confirm' }}
|
|
</button>
|
|
<button mat-button [mat-dialog-close]="false">{{ data.cancelText || 'Cancel' }}</button>
|
|
</mat-dialog-actions>
|
|
`,
|
|
styles: [`
|
|
mat-dialog-actions {
|
|
padding: 16px 24px;
|
|
}
|
|
`]
|
|
})
|
|
export class ConfirmDialogComponent {
|
|
constructor(
|
|
public dialogRef: MatDialogRef<ConfirmDialogComponent>,
|
|
@Inject(MAT_DIALOG_DATA) public data: {
|
|
title: string;
|
|
message: string;
|
|
confirmText: string;
|
|
cancelText: string;
|
|
}
|
|
) { }
|
|
} |