-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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-select doesn't reset placeholder effectively "clearing" selection #2634
Comments
I am seeing the same behavior. Does anyone have a workaround for this? |
@skeize @ig16022 When you select the first option without value and text, the So to fix the issue, you have to watch for the model change and explicitly nullify it:
|
@skeize We haven't yet implemented a convenient "clearing" API by clicking an option like there was in Material 1. In the meantime, you can do something like this: <md-select placeholder="Thing" formControlName="thing">
<md-option (click)="thing.reset()"></md-option>
<md-option *ngFor="let t of things" [value]="t.id">{{t.name}}</md-option>
</md-select> I had a note for this on the md-select board, but I'll keep this issue open so people can track when it gets in. |
…tion Allows for options, with a value of `null` or `undefined`, to clear the select. This is similar to the way the native select works. Fixes angular#3110. Fixes angular#2634.
…tion Allows for options, with a value of `null` or `undefined`, to clear the select. This is similar to the way the native select works. Fixes angular#3110. Fixes angular#2634.
…tion Allows for options, with a value of `null` or `undefined`, to clear the select. This is similar to the way the native select works. Fixes angular#3110. Fixes angular#2634.
…tion Allows for options, with a value of `null` or `undefined`, to clear the select. This is similar to the way the native select works. Fixes angular#3110. Fixes angular#2634.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
It's entirely possible I'm not doing things right, but... the placeholder within the md-select doesn't appear to be resetting from it's floating position after selecting an empty md-option.. effectively clearing the selection.
Here's what I've got:
My form/controls are defined as follow:
When initialized with a null value, the placeholder appears as it should, after choosing an option, then choosing the empty option (), the form control's value is set to null, however the placeholder doesn't leave the floating position.
I've also tried setting the empty option's value to null (<md-option [value]="null">) with no success.
I'm using Chrome on Windows 10.
Angular 2.4.3
Material 2.0.0-beta.1
Thanks!
The text was updated successfully, but these errors were encountered: