Trying to organize a table of results by a user selected criterion and then by a predefined secondary one.
For instance, the ng-repeat setup looks like this:
<tr ng-repeat="line in model.resultList | orderBy:['-predicate', 'secondary_value'] | limitTo:model.pageSize:model.beginFrom">
In this case, 'predicate' is specified in the controller's scope as $scope.predicate
. The name of the predicate changes dynamically based on user selections.
In situations where only the predicate is used, sorting works fine (e.g. orderBy:predicate:reverse
)
Is there a flaw in this approach? Can $scope values be used in an array within orderBy?