When populating options in an AngularJs <select>, an additional default <option> will be added until a value has been selected.
For example:
<select
ng-model="select1"
ng-options="title as title for title in ['Option 1', 'Option 2', 'Option 3']">
</select>
Produces the following HTML markup:
<select ng-model="select1" ng-options="title as title for title in ['Option 1', 'Option 2', 'Option 3']" class="ng-pristine ng-valid ng-empty ng-touched">
<option value="?" selected="selected"></option>
<option label="Option 1" value="string:Option 1">Option 1</option>
<option label="Option 2" value="string:Option 2">Option 2</option>
<option label="Option 3" value="string:Option 3">Option 3</option>
</select>
Once an option has been selected, for example "Option 1" then the initial <option> element is removed:
<select ng-model="select1" ng-options="title as title for title in ['Option 1', 'Option 2', 'Option 3']" class="ng-valid ng-touched ng-not-empty ng-dirty ng-valid-parse">
<option label="Option 1" value="string:Option 1">Option 1</option>
<option label="Option 2" value="string:Option 2">Option 2</option>
<option label="Option 3" value="string:Option 3">Option 3</option>
</select>
However I would like to add a default value of "Please Select" which is also removed once a value is selected.
If I set the <select> to:
<select
ng-model="select1"
ng-options="title as title for title in ['Option 1', 'Option 2', 'Option 3']">
<option value="">Please Select</option>
</select>
Then the value is not removed once a value has been selected.
I have also tried setting the value to ?, but then the option isn't displayed.
Here is a JsFiddle example to show my issue: https://jsfiddle.net/rq2cgedm/
How can I display a default value in the <select> element which is removed once a valid option has been selected, much like the default AngularJs behaviour?