Trying to set the default value in select depending on the id.
I have a object location
where <pre>{{location.routeId}}</pre>
prints an id 819e41ef-0081-41e6-a415-2766dc16e8e4
<select ng-model="location.route">
<option value="" disabled>Choose Route</option>
<option ng-repeat="route in appData.Routes"
ng-selected="{{route.id == location.routeId}}"
value="{{route}}">
{{route.id}} : {{route.name}}
</option>
</select>
The route
inappData.Routes
has parameters name
and id
, I'm trying to match route.id
with location.routeId
If I inspect element, I can seeng-selected
as true for one of the options, but still its not being selected in the UI.
And here is the screenshot of UI