I'm getting data from a Web Service to load a list in ionic, everything works fine but the scroll does not disappear when everything is loaded.
I followed codepen and found examples on the web and this all as it comes in the examples, I have no idea because not working.
JS:
.controller('MisViewsCtrl', function($scope){
$scope.moredata = false;
$scope.loadMore = function() {
console.log('Loading more!');
$timeout(function() {
$scope.refresh_view = [];
console.log(UrlService.url+'refreshView/'+sessionService.get("user_id")+'/'+sessionService.get("hash")+"/"+$scope.ultima_id);
$http({method: 'GET', url: UrlService.url+'refreshView/'+sessionService.get("user_id")+'/'+sessionService.get("hash")+"/"+$scope.ultima_id})
.success(function(data){
if(data.Count > 0){
angular.forEach(data.View, function(value, key) {
if(data.Count-1 == key){
$scope.ultima_id = value.id;
}
$scope.refresh_view.push(value);
});
$scope.views = $scope.views.concat($scope.refresh_view);
console.log($scope.ultima_id);
}else{
$scope.moredata=true;
}
});
$scope.$broadcast('scroll.infiniteScrollComplete');
$scope.$broadcast('scroll.resize');
$scope.$broadcast('scroll.resize')
}, 1000);
}
}
HTML :
<ion-infinite-scroll on-infinite="loadMore()" ng-if="!moredata" distance="2"></ion-infinite-scroll>