javascript - How to create Fixed page links in angularjs dir-pagination-controls? -
i new angularjs , have trying create fixed page links in dir-pagination-controls in angularjs have try use 'total-items=100' not working , getting values web services ,
what have tried
app.controller('listdata',['$scope', '$http', function($scope, $http) { $scope.xxxx = []; //declare empty array data = []; function getresultspage(pagenumber) { console.log('please wait while data loadind'); $http({ method: 'post', url: ajaxurl, params: { 'action': 'get_xxxx', 'pagenumber': pagenumber, 'usersperpage': $scope.usersperpage } }).success(function (data, status, headers, config) { $scope.xxxx = $scope.xxxx.concat(data); $scope.totalusers = 100; }); } $scope.users = []; $scope.totalusers = 0; $scope.usersperpage = usersperpage; // should match many results api puts on 1 page getresultspage(1); $scope.pagination = { current: 1 }; $scope.pagechanged = function(newpage) { console.log(newpage); getresultspage(newpage); }; $scope.sort = function (keyname) { $scope.sortkey = keyname; //set sortkey param passed $scope.reverse = !$scope.reverse; //if true make false , vice versa }; }]); <tr dir-paginate="xxxx in xxxxs|orderby:sortkey:reverse|filter:search|itemsperpage:usersperpage" > <!--td>{{xxxx.id}}</td--> <td>{{xxxx.name}}</td> <td>{{xxxx.neighborhood}}</td> <td class="td-edit"><img src="<?php echo esc_url(get_template_directory_uri()); ?>/dist/images/edit.png"></td> </tr> <dir-pagination-controls on-page-change="pagechanged(newpagenumber)"></dir-pagination-controls>
Comments
Post a Comment