I have dropdown in angularJS using ng-options. I need to use filter: and orderBy: component together for the ng-options My filter for the select is working fine, however the OrderBy: component does not seem to be working.
Below is my code implementation of what I have tried:
<label class="control-label">My Dropdown 123</label>
<input type="search" ng-model="searchFilter.Name" class="" placeholder="Search"></input>
<select class="form-control"
ng-options="l as (l.ID ? (l.ID + ' ' + '-' + ' '): '' ) + l.Name + ' ' +'('+ l.ID + ') ' for l in vm.values | orderBy: l.Name | filter: searchFilter track by l.ID "
data-ng-model="vm.values"
ng-disabled="vm.isReadOnly">
<option value="">All</option>
</select>
Please guide and advice as how I can make the orderBy and filter work together for ng-options in AngularJS with HTML.
Any help or advice will be highly appreciated.
Thanks in advance
Resolved the issue by using :
| orderBy: 'l.Name'
The orderBy parameter has to be in single quotes '' for the orderBy: component to work
Hope it is helpful for others :)