[ADF-4406] - Confirm Dialog doesn't support a third extra button option to be customised (#4608)

* [ADF-4406] - Confirm Dialog doesn't support a third extra button option to be customised

* * comments fixed

* * docs and test added
This commit is contained in:
dhrn
2019-04-23 04:13:10 +05:30
committed by Eugenio Romano
parent b58e040d7e
commit 64391a48fa
7 changed files with 89 additions and 0 deletions

View File

@@ -15,4 +15,15 @@
</mat-expansion-panel-header>
<button mat-raised-button (click)="openConfirmCustomDialog()">Open Custom Dialog</button>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Confirm Dialog Third Option
</mat-panel-title>
<mat-panel-description>
Provide extra button in the action section
</mat-panel-description>
</mat-expansion-panel-header>
<button mat-raised-button (click)="openConfirmCustomActionDialog()">Open Custom Dialog</button>
</mat-expansion-panel>
</mat-accordion>

View File

@@ -48,4 +48,22 @@ export class ConfirmDialogExampleComponent {
minWidth: '250px'
});
}
openConfirmCustomActionDialog() {
const thirdOptionLabel = 'Yes. Don\'t Show it again';
const dialog = this.dialog.open(ConfirmDialogComponent, {
data: {
title: 'Upload',
thirdOptionLabel: thirdOptionLabel,
message: `This is the default message`
},
minWidth: '250px'
});
dialog.afterClosed().subscribe((status) => {
// do the third option label operation
if ( status === thirdOptionLabel) {
// console.log('third option clicked');
}
});
}
}