Track by is not working with ng-repeat and ng-value

191 Views Asked by At
// this.data = [{value: 'damon'}];
// this.dataOrf = [{value: 'damon'}, {value: 'mean'}]

<md-select multiple ng-model="$ctrl.data" aria-label="data">
   <md-option ng-value="opt" ng-repeat="opt in $ctrl.dataOrf track by opt.value">
       {{opt.value}}
   </md-option>
</md-select>

All I want is to initiate multi-select dropdown with this.data and return the updated array of an object when the user makes any changes.

Problem: multi-select dropdown is not initiated that means dropdown options are not getting selected according to the model provided.

1

There are 1 best solutions below

1
On

seems like you are assigning damon object to value property

What about changing your property value to

this.data = [{value: 'damon'}];
this.dataOrf = [{value: 'damon'}, {value: 'mean'}]