Closed
Description
Feature request
What is the expected behavior?
It should be possible to assign a value to the md-dialog-close attribute which will be next value of the afterClose observable. For example:
<md-dialog-actions align="end">
<button md-raised-button [md-dialog-close]="'ABC'">No</button>
<button md-raised-button [md-dialog-close]="'DEF'" color="primary">Yes</button>
</md-dialog-actions>
const dlgRef = this._dialog.open(ConfirmationDialogComponent);
dlgRef.afterClosed().subscribe(next => {
if (next === "ABC") {
this.doThis();
} else {
this.doThat();
}
});
or
<md-dialog-actions align="end">
<button md-raised-button [md-dialog-close]="false">No</button>
<button md-raised-button [md-dialog-close]="true" color="primary">Yes</button>
</md-dialog-actions>
const dlgRef = this._dialog.open(ConfirmationDialogComponent);
dlgRef.afterClosed().subscribe(next => {
if (next) {
this.doThis();
} else {
this.doThat();
}
});
What is the current behavior?
md-dialog-close
closes the dialog but doesn't pass a value.
What is the use-case or motivation for changing an existing behavior?
To simplify the implementation of a md-dialog component.
Which versions of Angular, Material, OS, browsers are affected?
Component | Version |
---|---|
@angular/cli | 1.0.2 |
node | 7.10.0 |
os | win32 x64 |
browsers | all |
@angular/animations | 4.1.1 |
@angular/common | 4.1.1 |
@angular/compiler | 4.1.1 |
@angular/core | 4.1.1 |
@angular/forms | 4.1.1 |
@angular/http | 4.1.1 |
@angular/material | 2.0.0-beta.3 |
@angular/platform-browser | 4.1.1 |
@angular/platform-browser-dynamic | 4.1.1 |
@angular/platform-server | 4.1.1 |
@angular/router | 4.1.1 |
@angular/cli | 1.0.2 |
@angular/compiler-cli | 4.1.1 |
Metadata
Metadata
Assignees
Labels
No labels