Deamon
Deamon

Reputation: 109

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

// 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.

Upvotes: 0

Views: 183

Answers (1)

rafaelsr
rafaelsr

Reputation: 133

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'}]

Upvotes: 0

Related Questions