-
Notifications
You must be signed in to change notification settings - Fork 852
Open
Description
I'm using dirPagination to populate table, I have set total-items and current-page dynamically from angularJS controller, Aysnchronous call populates data correctly for page 1, but when i click on page 2 API call returns next set of result, Page 2 is higlighted and date is set to array but data not displaying in UI.
<!-- HTML code -->
<tr dir-paginate="item in List | orderBy:sortKey:reverse |
filter:searchPolicy | itemsPerPage:pageSize track by $index" total- items="totalItems" current -
page="currentPage">
<td> </td>
<tr>
<dir-pagination-controls max-size="10" ng-if="List!=null"
on-page-change="pageChanged(newPageNumber)"
template-url="tpl/dirPagination.tpl.html" direction-links="true"
boundary-links="true">
```
//In Controller
$scope.pageSize = 5;
$scope.totalItems = 0;
var start = 0;
var max = 5;
$scope.currentPage = 1;
$scope.pageChanged = pageChanged;
function pageChanged(pageNum) {
if (pageNum == 1) {
start = 0;
$scope.policyList = [];
} else {
start = max * (pageNum - 1);
}
$scope.currentPage = pageNum;
getList();
}
//getList function
$scope.getList = getList;
function getList() {
$scope.parameter.pageNumber = $scope.currentPage;
$scope.parameter.itemsPerPage = max;
var result =
homeService.getList($scope.parameter);
result.then(function (success) {
$scope.List = success.data.resultList;
}, function (error) {
};
});
}
```
Metadata
Metadata
Assignees
Labels
No labels