javascript - ng-options: how to put empty option at the end? -
currently, i've got (simplified):
<select ng-model=model.policyholder ng-options="person.index person.name person in model.insurance.persons"> <option value>someone else </select>
this creates dropdown options person names , empty 1 "someone else" @ top. question is, how empty option at bottom of dropdown?
i keep using ng-options
this, since controlling position of default option seems small change justify more verbose <option ng-repeat>
way.
thanks!
use option value=""
like:
<select ng-model="model.policyholder" ng-options="person.index person.name person in model.insurance.persons"> <option value="">someone else</option> </select>
if want show someone else @ bottom when click on drop-down list can use.
<select ng-model="model.policyholder"> <option ng-repeat="person in model.insurance.persons" value="{{person.index}}">{{person.name}}</option> <option value="">someone else</option> </select>
Comments
Post a Comment