I am currently working on an AngularJS select element with ng-options using the code below:
<select ng-model="vm.selectedship" ng-change="vm.updateShip()" data-ng-options="ship as ('ship' + ' is ready (' + ship.currentlocation + ')') for ship in vm.readyships">
This code generates the following output:
<select class="ng-valid ng-dirty ng-touched" data-ng-options="ship as ('ship' + ' is ready (' + ship.currentlocation + ')') for ship in vm.readyships">
<option label="" selected="selected" value="?">
</option>
<option label="ship is ready (New york)" value="0">
ship is ready (New york)
</option>
<option label="ship is ready (City2)" value="1">
ship is ready (City2)
</option>
<option label="ship is ready (City3)" value="2">
ship is ready (City3)
</option>
<option label="ship is ready (City24)" value="3">
ship is ready (City24)
</option>
<option label="ship is ready (City24)" value="4">
ship is ready (City24)
</option>
</select>
However, after selecting an option, the text within the selector remains blank like this
https://i.sstatic.net/hMxEY.png
Q: How can I make sure the selected text appears within the selector? Also, how do I remove the blank option?
EDIT:
Currently, I am utilizing vm.selectedship to retrieve the entire property of the selected ship. If any adjustments are required here, I need to somehow select the ship to a vm.property differently.