first commit
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
<h1 mat-dialog-title>
|
||||
{{title}}
|
||||
</h1>
|
||||
|
||||
<div mat-dialog-content>
|
||||
<p>{{message}}</p>
|
||||
</div>
|
||||
|
||||
<div mat-dialog-actions>
|
||||
<button mat-button (click)="onDismiss()">No</button>
|
||||
<button mat-raised-button color="primary" (click)="onConfirm()">Yes</button>
|
||||
</div>
|
||||
@@ -0,0 +1,37 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import {MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
|
||||
|
||||
@Component({
|
||||
selector: 'app-confirm-dialog',
|
||||
templateUrl: './confirm-dialog.component.html',
|
||||
styleUrls: ['./confirm-dialog.component.css']
|
||||
})
|
||||
export class ConfirmDialogComponent {
|
||||
title: string;
|
||||
message: string;
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<ConfirmDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: ConfirmDialogModel) {
|
||||
this.title = data.title;
|
||||
this.message = data.message;
|
||||
}
|
||||
|
||||
onConfirm(): void {
|
||||
this.dialogRef.close(true);
|
||||
}
|
||||
|
||||
onDismiss(): void {
|
||||
this.dialogRef.close(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class to represent confirm dialog model.
|
||||
*
|
||||
* It has been kept here to keep it as part of shared component.
|
||||
*/
|
||||
export class ConfirmDialogModel {
|
||||
|
||||
constructor(public title: string, public message: string) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user