Skip to content Skip to sidebar Skip to footer

Angular : Ng-select Does Not Show Ng-selected Value

Trying to set the default value in select depending on the id. I have a object location where
{{location.routeId}}
prints an id 819e41ef-0081-41e6-a415-2766d

Solution 1:

Take out the disabled attribute in your first option.

Solution 2:

You don't need curly braces for ngSelected directive. So simply remove them:

ng-selected="{{route.id == location.routeId}}"

To:

ng-selected="route.id == location.routeId"

Solution 3:

Try this:

<selectng-model="location.route"><optionvalue="">Choose Route</option><optionng-repeat="route in appData.Routes"ng-selected="route.id == location.routeId || location.route && route.id == location.route.id"ng-value="route">
             {{route.id}} : {{route.name}}
        </option></select>

Post a Comment for "Angular : Ng-select Does Not Show Ng-selected Value"