javascript - Angular ng-options track by overriding ng-model default option -


i have ng-options iterating on object, key of object value need ng-options set to.

i set ng-model in controller default select box.

using track by breaks ng-model default, stopping track by removes issue introduces default of select box no longer key of object.

how can around issue?

the html using follows

<select       class="form-control"       ng-change="flightnumber = airline[0]"       name="airline"       id="airline"       ng-model="airline"       ng-options="airline (airline, flights) in orderedflights track airline"> </select> 

in controller have following:

var flights = {     "airline": {      },     "airline 2": {      },     "-- no airline selected --": [         {             unselected: true         }     ]; }  $scope.orderedflights = flights; $scope.airline = flights["-- no airline selected --"]; 


Comments