I am using dir-pagination directive by @michaelbromley. I want to get all the records on the current page of directive. Is there any way to do this?
Here is the link: dir-pagination, so I need a collection of 5 records
from 100 to 96. Is there any quick way to do it?
I have tried couple of things but not working.
Here is another possible way to do it, which does not require you to duplicate the logic from the dir-paginate
expression:
For each repeated item, you could just push that item into an array in your controller. This will of course give you all the items for that page.
Here is an example:
<ul>
<li dir-paginate="meal in perman = ( meals | filter:q ) | orderBy: order?'key':'-key' | itemsPerPage: pageSize" current-page="currentPage" ng-init="addMeal(meal)">{{ meal.key + ': ' +meal.val }}</li>
</ul>
Then in the controller:
$scope.addMeal = function(meal) {
if (meal) {
if ($scope.page.length === $scope.pageSize + 1) {
$scope.page = [];
}
$scope.page.push(meal);
}
}
I've not expensively tested it, but the general principle should work. It's a bit hacky in my opinion, but it's worth knowing as an alternative to the answer provided by Rathish.