-
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
Bug: md-select doesn't set selected value if options are initialized after the model #2497
Comments
…dded asynchronously Fixes the select component not highlighting the model value when the options get added after initialization. Fixes angular#2497.
Is there any way to apply this patch crisbeto@2f2cc8e to the project |
@drPavka as a workaround you can add something like *ngIf="options && options.length" to your md-select. This way component would not be initialized until options are ready. |
…dded asynchronously Fixes the select component not highlighting the model value when the options get added after initialization. Fixes angular#2497.
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. |
Bug, feature request, or proposal:
Bug, if ngModel of md-select is set before setting of options - select doesn't show selected value after both (options and model) are set.
What is the expected behavior?
Showing selected value after both (model and options) are set.
What is the current behavior?
Selected value is shown if options are set before ngModel value, otherwise selected value is not shown.
What are the steps to reproduce?
http://plnkr.co/edit/yL8QJBjABGPRerqGIR2b?p=preview
You see two selects, left one shows selected value, right one - doesn't.
What is the use-case or motivation for changing an existing behavior?
For ajax loaded value and options the order of initialization is not guaranteed. Without fixing this bug you need to add an additional logic to the app to init select value only after options array is set.
Which versions of Angular, Material, OS, browsers are affected?
Tested with Angular 2.4.1, Angular material 2.0.0-beta.1.
Is there anything else we should know?
The text was updated successfully, but these errors were encountered: