material icon indicating copy to clipboard operation
material copied to clipboard

(md-select) fails to display text on pre-selected object

Open bijoux opened this issue 11 years ago • 4 comments

It appears the text values are not displayed for pre-selected objects http://codepen.io/anon/pen/jPYwwY

bijoux avatar Jun 28 '15 04:06 bijoux

The issue is that <md-option ng-value="{{topping.name}}"> sets the ng-model to the topping.name property so in this case it is "Bacon" not {name: "Bacon", category: "meat"}. See this codepen for an example of it working.

rschmukler avatar Jun 28 '15 20:06 rschmukler

What if I need the model to be an object like how md-select behaved before the change. I think this codepen shows the issue better. I think this is related to #3489

bijoux avatar Jun 30 '15 12:06 bijoux

The issue is that ngModel doesn't know that these objects are the same (because technically, they point to different objects in memory). To get around this ngModel exposes ng-model-options where you can specify what you track by. Check out this code for a demo of using it.

rschmukler avatar Jun 30 '15 17:06 rschmukler

Cool, thanks. I think I got md-select behaving like it was before. Thanks for the quick response, we really appreciate that.

bijoux avatar Jul 01 '15 00:07 bijoux