HTML code:
<table style= "width:100%" >
<tr>
<td> total: <span style= "color: #12bdce; font-weight:bold;" >{{total_pages}}</span> page <span style= "color: #12bdce; font-weight:bold;" >{{total}}</span> Bar </td>
<td style= "text-align:right;" >
<div layer-pages id= "Page_bar" data-options= "url: ' busmaintenanceitem/query.do ', callback: ' Getpagedatalist ', Pagecolor: ' #12bdce ', pageSize: ' Ten ', Groups: ' 3 ', Isskip:false ' style= ' margin-right:0px; ></div>
</td>
</tr>
</table>
JS callback method:
Gets the current page data information (for paging instruction callback)
$scope. getpagedatalist = function (pageInfo) {
$scope. maintenanceitemlist = pageinfo.data_list;//data
$scope. Total = pageinfo.total;//number
$scope. total_pages = pageinfo.total_pages;// Total number of bars
}
Specific paging instruction code
App.directive ("Layerpages", [' $rootScope ', ' $compile ', ' Page ', function ($rootScope, $compile, Page) {return {
Restrict: ' AE ', link:function (scope, Elem, attrs) {var page_id = attrs.id; var options =eval (' [{' +] + (Attrs.options | | ') + '}] ' [0] var url = options.url;//Data interface var page_color =options.pagecolor;//color var page_g roups = options.groups;//continuous pages var page_size = options.pagesize;//per-page display bars var page_is_skip = options.is skip;//whether to turn on page-skipping var callbackfun = scope. $eval (options.callback);//callback function if (!callbackfun | |!typeof (CALLBA
Ckfun) = = ' function ') {return;
} var page_index = 0;
var param = {};
Param._pageindex = Page_index;
Param._pagesize = page_size;
Page.ajaxpost (URL, param, function (resp) {var data_list = resp.data.rows; var total = resp.data.total;//Gross page_pages = Math.ceil (total% page_size = 0? total/pagesize:total/page_size);
var pageInfo = {};
Pageinfo.data_list = data_list;
Pageinfo.total = total;
Pageinfo.total_pages = total_pages; Callbackfun (PageInfo);
Callback Laypage ({cont:page_id, pages:total_pages,//gets the total number of pages Skin:page_color,
Skip:page_is_skip,//whether to open the jump page prev:false,//If not displayed, set false to Next:false,//If not displayed, set false
Groups:page_groups,///Continuous page curr:1,//initialization of current pages jump:function (Obj,first) {//Trigger paging callback /*obj is an object type.
Includes all the configuration information for pagination. First a Boolean class that detects whether the page is initially loaded. Very useful to avoid infinite refreshes.
*/if (!first) {param._pageindex = obj.curr-1;
Page.ajaxpost (URL, param, function (resp) {var data_list = resp.data.rows;
Pageinfo.data_list = data_list;
Callbackfun (pageInfo);//callback});
}
}
}) });
}
}
}]);
Effect Chart: