Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add value to md-dialog-close attribute #4421

Closed
NCC1701M opened this issue May 8, 2017 · 2 comments
Closed

Add value to md-dialog-close attribute #4421

NCC1701M opened this issue May 8, 2017 · 2 comments
Assignees

Comments

@NCC1701M
Copy link

NCC1701M commented May 8, 2017

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
@devversion devversion self-assigned this May 8, 2017
devversion added a commit to devversion/material2 that referenced this issue May 8, 2017
* Values can be bound to the md-dialog-close directive and the value will be returned automatically to the `DialogRef`.

Closes  angular#4421
devversion added a commit to devversion/material2 that referenced this issue May 8, 2017
* Values can be bound to the md-dialog-close directive and the value will be returned automatically to the `DialogRef`.

Closes angular#4421
@devversion
Copy link
Member

Done with #4332

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants