1

I´m having an issue with to select a default value on a select with Angular. If my select options only has one value it´s ok and works fine

<select id="customerId"
        ng-model="customer"
        ng-options="customer.id  for customer in customersSelect">
</select>

In my angular js:

 $scope.customer = customer;

But if I try with multiple elements on ng-options and I set the default option, is not working

<select id="customerId"
        ng-model="customer"
        ng-options="customer.id as customer.name for customer in customersSelect">
</select>

Any ideas?

Andreas Louv
  • 46,145
  • 13
  • 104
  • 123
paul
  • 12,873
  • 23
  • 91
  • 153
  • Does this help? http://stackoverflow.com/questions/20845210/setting-selected-values-for-ng-options-bound-select-elements – Ric Oct 20 '15 at 14:28

1 Answers1

0

You can use a option tag.like below:

   <select 
        id="customerId"
        ng-model="customer"
        ng-options="customer.id as customer.name for customer in customersSelect">
       <option value="">PLease select one</option>
</select>                          

Thats it.

monsur
  • 601
  • 6
  • 18