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

md-dialog-close should also have an input for mdDialogClose #6278

Closed
kherock opened this issue Aug 4, 2017 · 2 comments · Fixed by #6293
Closed

md-dialog-close should also have an input for mdDialogClose #6278

kherock opened this issue Aug 4, 2017 · 2 comments · Fixed by #6293
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@kherock
Copy link
Contributor

kherock commented Aug 4, 2017

Bug, feature request, or proposal:

Request

What is the expected behavior?

Using the dialog close directive should allow the following syntax

<button md-button [mdDialogClose]="true">Okay</button>

What is the current behavior?

Angular complains it can't bind to mdDialogClose since it isn't listed as a valid input

What are the steps to reproduce?

https://plnkr.co/edit/m7e7vFIKKgTiWIwCY7pc?p=preview

What is the use-case or motivation for changing an existing behavior?

I've noticed that across the library, components use kebab-case and directives use camelCase (but also allow kebab-case) for their selectors. I'd like to keep this consistent within my application, but I can't because while [mdDialogClose] is a valid selector, I can't bind a value to it.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Latest

@jelbourn jelbourn added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label Aug 4, 2017
@crisbeto crisbeto added the has pr label Aug 5, 2017
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 5, 2017
…se selectors

Fixes not being able to pass in a dialog result through the `mdDialogClose`, `matDialogClose` and `mat-dialog-close` selectors, even though they are allowed by the `MdDialogClose` directive.

Fixes angular#6278.
mmalerba pushed a commit that referenced this issue Aug 8, 2017
…se selectors

Fixes not being able to pass in a dialog result through the `mdDialogClose`, `matDialogClose` and `mat-dialog-close` selectors, even though they are allowed by the `MdDialogClose` directive.

Fixes #6278.
mmalerba pushed a commit that referenced this issue Aug 8, 2017
…se selectors (#6293)

Fixes not being able to pass in a dialog result through the `mdDialogClose`, `matDialogClose` and `mat-dialog-close` selectors, even though they are allowed by the `MdDialogClose` directive.

Fixes #6278.
@seba161189
Copy link

seba161189 commented May 23, 2018

Try to save the initial value when the dialog is open so you can return if you press close.
COMPONENT
form: FormGroup;
initSalary: number; //in close return this one
constructor(
private formBuilder: FormBuilder,
public dialogRef: MatDialogRef,
@Inject(MAT_DIALOG_DATA) private data
) {}

ngOnInit() {
this.form = this.formBuilder.group({
salary: this.data ? this.data.salary : ''
});

this.initSalary = this.form.value.salary;

}

submit(form) {
this.dialogRef.close(${form.value.salary});
}

close() {
this.dialogRef.close(this.initSalary);
}
}

@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 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants