I'm currently paginating my ngRepeat
through a combination of a custom startAtIndex
filter and a limitTo
filter. I want to display the total number of results in the data set regardless of the page. However, when you use limitTo
, this obviously chops the array off at that point, and you can't get the length property you want.
My ngRepeat
:
ng-repeat-start="colleague in pagination.filteredData = (colleagueDataArray | filter:{name: queries.name} | filter:{client: queries.client} | filter:queries.generalQuery | orderBy:sortByField:reverseSort | startFrom: pagination.startAtIndex | limitTo:pagination.pageSize)">
I assign the results of the filter to the pagination.filteredData
object, I can then display it's length anywhere in my controller with {{pagination.filteredData.length}}
.
How can I go about this to get the length of the filtered array before it's filtered by startAtIndex
and limitBy
? Can I somehow partially filter the colleagueDataArray
array, and then filter the resulting filteredArray
again with the ngRepeat
?
If this makes no sense to you, please let me know so I can edit the question.
Write a custom filter, whatever you are trying there.
ng-repeat="data in bigData | filter:myfilter"
$scope.myfilter= function(data)
{
// Check length or i dont know
// $scope.bigData.length
if($scope.bigData.length > 2)
{
return true; // this will be listed in the results
}
return false; // otherwise it won't be within the results
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.