Im trying to change the item of md-select programmatically and tried using ng-model-options="{trackBy: '$value.id'}"
but this code won't work. Did i missed something so simple?
You can take a look at this DEMO
The md-select
element does not have an attribute for ng-model-options
since it's not stated in the docs .
Anyways, it looks like you have to instead of track by data
, use track by $index
.
<md-select ng-model="selectedAnimal">
<md-option
ng-value="item"
ng-repeat="item in data track by $index">
{{item.animal}}
</md-option>
</md-select>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.