hi everybody,
i m trying to implement loadMore() function on infinite-scroll , the issue is that load more is executed automatically wihtout scrolling down and the other problem is that the function doesn’t work any more when i charge a new slide my view is like that :
my controller is like bellow:
.controller('ActivityController',function($scope, $http,$state,$ionicSlideBoxDelegate,$timeout,$rootScope,globalVariables,$stateParams) {
$http.get('http://192.168.1.180:8080/backendPay/v1/Account/inquiryAll/'+$rootScope.member.idUser+'?access_token='+$rootScope.clientToken).success(function(data){
$rootScope.listOfAccounts=data.accounts;
$ionicSlideBoxDelegate.update();
$rootScope.AccountFirstIndex=data.accounts[0].idAccount;
$http({
method:"POST",
url:'http://192.168.1.180:8080/backendPay/v1/Payment/inquiryAllPage/'+$rootScope.AccountFirstIndex+'?access_token='+$rootScope.clientToken,
data:{"count":1,"startId":globalVariables.pagingSize ,"sortBy":"createTime","sortOrder":"desc"}
}).success(function(data){
//listPay
$scope.listAccount=data.list_payment_pageable;
$ionicSlideBoxDelegate.update();
});
});
$scope.slideHasChanged=function(index){
$rootScope.deosSlideChanged=false;
$rootScope.AccountFirstIndexe=index;
globalVariables.pagingSize=0;
$scope.listAccount=new Array();
$http({
method:"POST",
url:'http://192.168.1.180:8080/backendPay/v1/Payment/inquiryAllPage/'+$rootScope.AccountFirstIndexe+'?access_token='+$rootScope.clientToken,
data:{"count":1,"startId":globalVariables.pagingSize,"sortBy":"createTime","sortOrder":"desc"}
}).success(function(data){
$scope.listAccount=data.list_payment_pageable;
$scope.$on('$stateChangeSuccess', function() {
$scope.loadMore();
});
console.log($scope.listAccount);
});
};
$scope.loadMore=function(){
globalVariables.pagingSize=$scope.listAccount.length;
console.log("loadMore");
$http({
method:"POST",
url:'http://192.168.1.180:8080/backendPay/v1/Payment/inquiryAllPage/'+$rootScope.AccountFirstIndex+'?access_token='+$rootScope.clientToken,
data:{"startId":globalVariables.pagingSize,"count":1,"sortBy":"createTime","sortOrder":"desc"}
}).success(function(data){
if(angular.equals([],data.list_payment_pageable)){
$rootScope.noMoreItemsAvailable=true;
}
else{
console.log(data.list_payment_pageable);
$scope.listAccount.push(data.list_payment_pageable[0]);
}
});
$scope.$broadcast('scroll.infiniteScrollComplete');
};
})
thank you