Ionic Framework infinite scroll with http get data
Got it working :)
function MyController($scope, $http) { $scope.posts = []; $scope.page=1; $scope.loadMore = function() { $http.get('http://wallweight.com/api/get_recent_posts?page='+$scope.page).success(function(items) { var i = items.posts.length; $scope.posts = $scope.posts.concat(items.posts); $scope.posts.push(items); console.log(items.posts[0]); $scope.$broadcast('scroll.infiniteScrollComplete'); console.log($scope.page); $scope.page +=1; }); };
Try
$scope.posts = $scope.posts.concat(items.posts);
instead
$scope.posts=items.posts;
comment this line //$scope.newsletters.push(data); it add as another item entire data.