Reputation: 7057
I have a select box.
When no value is selected, I have the empty option --
. It's OK !
Once an option is selected, the empty option disappears.
But I would like that it is always there to have the opportunity to choose --
.
Is it possible ?
<select ng-model="project" ng-options="act.id as act.name for act in actors"></select>
Upvotes: 5
Views: 6234
Reputation: 59
ng-options gets priority when any option is selected from .
As per the standard html can contain . Thus the mentioned option gets priority as the selection is null.
And in view, html priority is higher, thus always value is seen unless the ng-option value already selected from controller.
Upvotes: 0
Reputation: 16498
please see here:http://plnkr.co/edit/SWpRZA1dafNNva70z6KE?p=preview
<select ng-model="project" ng-options="act.id as act.name for act in actors">
<option value="">--<option>
</select>
Upvotes: 9