首页 新闻 搜索 专区 学院

如何将模拟数据设置为分页形式

0
悬赏园豆:10 [待解决问题]

如和将模拟数据设置为分页形式,我想做上拉加载用,现在上拉加载 无限加载 下面是我的代码 

控制器中

$scope.loadMoreData = function(){
if($scope.dataFromView.footerbtn=='dynamicBranch'){ //动支签批头部
action=''
}
$$altair.getData(action,method,$scope.handlerID,{
onSuccess: function (data) {
$scope.approvalData=data;
$scope.$broadcast('scroll.infiniteScrollComplete');
// $scope.moreDataCanBeLoaded = false;
},
onError: function (e) {
console.log(e);
}
});
$scope.moreDataCanBeLoaded = false;
// $scope.$broadcast('scroll.infiniteScrollComplete');
};
$scope.$on('stateChangeSuccess', function() {
$scope.loadMoreData ();
});
模拟数据
"Data":[
{
"Batchno" : "batchno01",//流水号
"Applyno" : "apply01",//申请号
"Comname" : "中国民生银行",//公司名称
"Deptname" : "事业部",//申请部门
"Username" : "老王",//申请人
"Applydate" : "2016年12月12日",//申请日期
"Totalmoney" : "555.00",//报销金额
"Reason" : "出差",//报销原因
"Applystate" : "wait",//申请状态代码
"Processid":"processid01" //工作流实例号
},
HTML

<ion-list ng-repeat="approval in approvalData">
<ion-item class="item-overwrite"
ng-class="{
'wait':approval.Applystate=='wait',
'complete':approval.Applystate=='complete'
}"
ng-click="goPage(dataFromView.footerbtn,approval.Batchno)">
<div class="info">
<div class="part">
{{approval.Batchno}}
<span style="float:right;margin-right: 12%">{{approval.Applydate}}</span>
</div>
<div class="part">
{{approval.Username}} &nbsp; | &nbsp;{{approval.Comname}}{{approval.Deptname}}
</div>
<div class="part">
{{approval.Reason}}
&nbsp;&nbsp;
<img src="assets/altairImg/spend.png">
&nbsp;
<span class="money">{{approval.Totalmoney}}元</span>
</div>
</div>
</ion-item>
</ion-list>
<!--上拉加载-->
<ion-infinite-scroll
ng-if="moreDataCanBeLoaded = true"
on-infinite="loadMoreData()"
distance="1%">
</ion-infinite-scroll>
</ion-content>



Aaron.wei的主页 Aaron.wei | 初学一级 | 园豆:194
提问于:2017-01-19 14:14
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册