I have a dropdown box with options for filtering data in an ng-repeat by different criteria. How can I pass the selected value from the dropdown to the ng-repeat orderby?
Here is my dropdown:
<select name='filter_range' id='filter_range' onchange='filter()'>
<option value='mrplow'> MRP Low To High</option>
<option value='mrphigh'> MRP High To Low </option>
<option value='qtyhigh'> Qty Low To High </option>
<option value='qtylow'> Qty High To Low </option>
</select>
Using AngularJS:
<div ng-app="myApp" ng-controller="MyController">
<div ng-repeat="grp_val in sample | orderBy:selectedValue">
<label>{{grp_val.product}}</label><br>
</div>
</div>
How can I dynamically set the orderBy value to the one selected in the dropdown?