htmlangularjsangularjs-scope

How to add empty option in select in AngularJS?


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>

Solution

  • 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>