md-select default value is not support object?
Bug, feature request, or proposal:
I want to display selected value in md-select, the value is an Object. not string.
What is the expected behavior?
to display the correct option from the select.
What is the current behavior?
not display. in the plunker should be: "United States" at the begging.
What are the steps to reproduce?
here: https://plnkr.co/edit/nCJLd5?p=preview
What is the use-case or motivation for changing an existing behavior?
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Is there anything else we should know?
This is not a bug. Please keep GitHub issues for bug reports / feature requests. Better avenues for troubleshooting / questions are stack overflow, gitter, mailing list, etc.
As pointed out by @donroyco, this is not a bug. Even though the Object you passed to selectedCountry looks like countries[1], they are different objects so the select wouldn't know which option to display.
In order to select any of the options, you have to select one of the objects you passed to the select, i.e. an Object from the countries list. Here's an updated plunker: https://plnkr.co/edit/GmlISyGT3BSBWxAryEiD?p=preview
You can now pass a compareWith function to MdSelect. See https://material.angular.io/components/select/api
@willshowell YEAH!!! U R D BEST! :)
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.