Search code examples
angularjsng-options

Adding an All Option with ng-options


I am currently filtering through a data set to retrieve each unique name and put it into a drop down menu.

  <select ng-model="Employee" ng-options="order.SPerKey as order.SPerName for order in data.Root.Orders | unique:'SPerKey'"> </select> 

I would like to add an option to this drop down called "All" so my drop down would start with the All option and then add the filtered names after that.


Solution

  • Just include All option in select

    <select ng-model="Employee" ng-options="order.SPerKey as order.SPerName for order in ata.Root.Orders  unique:'SPerKey'"> 
       <option value="">All</option>
    </select>