Pass extra parameters to custom sort function in AngularJS Pass extra parameters to custom sort function in AngularJS angularjs angularjs

Pass extra parameters to custom sort function in AngularJS


You could call your custom sort with the predicate and return a closure being your original function, now your function has access to predicate:

<div ng-repeat="sale in sales | orderBy:customSort(predicate)">$scope.customSort = function(predicate) {    return function(sale) {    };};