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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -