var dataList = [];
$scope.page = {
page:1,
pageSize:15,
numPerPageOpt:[15,30,50,100],
totalNum:0,
totalPage:0
};
$scope.pageChange = function(pageNum){
if(!pageNum){
pageNum = $scope.page.page;
}
var from = (pageNum-1)*$scope.page.pageSize;
var to = pageNum*$scope.page.pageSize;
$scope.stores = dataList.slice(from,to);//最终展示页面的数据
};
function loadStore(data){
$scope.page.totalNum = data.hosts.length;
var total=0-$scope.page.totalNum;
dataList =angular.forEach(data.hosts,function (item) {
var index=data.hosts.indexOf(item);
return 0-index;
});
$scope.pageChange(1);
}
loadStore(data)//要处理分页的数据