Does anyone know how to set up an initial default option in an Angularjs Select?
"myMapByCmd" below is a
LinkedHashMap<String, List<String>>
and so the "value" in item as item for item in value track by $index" is a List<String>.
If I put "Select value" first in the List from the back end, the selector initially shows/selects the last item in the list.
Man there must be a simple way to do this (Damn Angular is so fiddelly !)
<table>
<tr ng-repeat="(key,value) in myMapByCmd">
<td><label>{{key}} Title:</label></td>
<td>
<select name="my_val_sel"
ng-init="mycommand.myValue[$index] = value[0]"
ng-model="mycommand.myValue[$index]"
ng-options="item as item for item in value track by $index"
ng-change="changeMyValue()">
</select>
</td>
</tr>
</table>
if I do this it shows last and unselected...
<select name="my_val_sel" ng-model="mycommand.myValue[$index]"
ng-options="item as item for item in value track by $index"
ng-change="changeMyValue()">
<option value="" ng-selected="selected">FACK</option>
</select>
the myMapByCmd JSON looks like: { "ONE": [ "my-one", "my-two", "my-three" ] }
Thanks!