-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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-option): MdOption value isn't working properly #5406
Comments
I'm not sure I understand what you're after here. The initial value of the form is,
But your food options are,
Of course the select won't find equality in that list... Maybe you were trying to do this? http://plnkr.co/edit/w8dc3j8SD0P4bVXqAgjB?p=preview Or maybe you're looking for the ability to do a custom compare, for which there is an issue #2785 |
@willshowell I think you didn't understand the issue... Take a look on the following statement:
In other words, it'll be translated to something like this:
So, since I have the initial value |
Oh right, thanks for clarifying! From the issue description in #2785:
So even though the initial value and the third option look the same, they are different objects, therefore the initial binding won't occur. |
Closing based on @willshowell's explanation |
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.
What is the expected behavior?
What is the current behavior?
Let's see the example:
Array (for md-option's for):
Template (note the
[value]
):As you may have noticed, the
value
ofmd-option
will be something like this:The initialization of form control:
The problem is that the
md-option
isn't recognizing this value{'custom-key': 'tacos-2'}
(which one is correspondent to the third item offoods
array), so it keeps blank.What are the steps to reproduce?
Providing a Plunker (or similar) is the best way to get the team to see your issue.
Plunker template: https://goo.gl/DlHd6U
http://plnkr.co/edit/9YNIj8RDUrVkq3VXbV0s?p=preview
1 - See the default value once you open the plunker;
2 - Select the third item in array "Tacos";
3 - Check that it's exact the same value as it was in the initialization;
What is the use-case or motivation for changing an existing behavior?
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular: 4.2.x
Material: Material2 Beta.7
OS: Linux
Typescript: 2.3.4
Is there anything else we should know?
The text was updated successfully, but these errors were encountered: