Search code examples
angularjsangularjs-filter

angularjs filter with two parameters


OrderBy filter not work with 2nd parameter, it sort only by first parameter. Any ideas with how to solve this issue?

var found = $filter('orderBy')($scope.statusHistory, ['Id', { IsCreatedByMember: true}], true)[0];

Solution

  • It should use a function for expression, not an object:

    var found = $filter('orderBy')($scope.statusHistory, [
      'Id',
      item => item.IsCreatedByMember
    ], true)[0];