I'm facing a problem when using ngRepeat
and ngSelected
inside <select>
tag, this is the code:
<select ng-model="y.SkuId" ng-change="y.Edited=true;">
<option ng-repeat="s in skus" ng-selected="s.Key == y.SkuId" value="{{s.Key}}">{{s.Value}}
</option>
</select>
This works fine when the selected item is other than the first item, but when the selected is the first one, outputs wrong, instead that the html looks good
<option ng-repeat="s in skus" ng-selected="s.Key == y.SkuId"
value="1" class="ng-binding ng-scope" selected="selected">001
Note: the numbers are the values (not the index)
Update
Now I noticed that only when the last one item in options has the ngSelected
equals true, browsers displays fine
This is the skus data:
[{ "Key" : 1, "Value" : "001" }, { "Key" : 2, "Value" : "002" }]
Update 2
plnkr with example of error