Skip to content Skip to sidebar Skip to footer

How To Use Select Inside Ng-repeat And Keep Value Selected On Api Call Data

I am using select inside ng-repeat. I am trying to map value coming from my api to select as selected value. I don't know what's wrong going from my side, please correct me. Here i

Solution 1:

I was making so silly mistake i guess because after doing below changes my code worked, i changed ng-model to trip.type from selectedType, so only it is possible for ng-selected to check condition.

<divng-repeat="trip in trips">
{{trip.type}}
<selectng-change="typeChanged(selectedType,trip.id)"id=""name=""ng-model="trip.type"><optionng-selected="trip.type === t"ng-repeat="t in tripTypes">{{t}}</option></select></div>

Here is working fiddle Check now

Post a Comment for "How To Use Select Inside Ng-repeat And Keep Value Selected On Api Call Data"