I have set my ng-repeat in options along with ng-selected, but option is not getting selected, When I remove ng-model from select all become working.
HTML code:
<select ng-model="formData.value">
<option value="{{item.value}}" ng-selected="{{((item.value).indexOf(formData.value) != -1 ? true:'') == formData.value}}" ng-repeat="item in levels">{{ item.name}}</option>
</select>
Controller code:
$scope.levels= [
{"value": ["1", "2", "3"],"name": "High"},
{"value": ["4", "5", "6"],"name": "Medium"},
{"value": ["7", "8", "9"],"name": "Low"}
]
What I am doing here is, if the formData.value is between 1 to 3, i would like to show the dropdown field with High...
Its working fine without ng-model name, however I would like to get a value from the user and save it in the array. In that scenario, the dropdown doesn't show the selected field...