when i scroll to the bottom,keep repeat out same post for me,anything can help me please …here is my html code
<ion-item class="item-text-wrap" ng-repeat="post in posts" href="#/app/index/{{post.id}}">
<div class="item item-image">
<img ng-src="{{post.better_featured_image.source_url}}"/>
</div>
<h2 style="font-size: 20px; padding-top: 10px;"><b>{{post.title.rendered}}</b></h2>
<h3><i class="ion ion-ios-calendar-outline padding"></i>{{post.date | limitTo: 10}}</h3>
<p>{{post.plaintext | limitTo: 100}} {{post.plaintext.length > 150 ? '…' : '' }}</p>
</ion-item>
</ion-list>
<ion-infinite-scroll
on-infinite="loadMore()"
distance="1%">
</ion-infinite-scroll>
here is my controller
angular.module(‘menu.CTRL’, [])
.controller(‘mainCTRL’, function($scope, $http, $ionicModal, $ionicHistory, $state) {
$scope.posts = [];
$http({
method:"GET",
url: "http://www.maixandsandy.com/wp-json/wp/v2/posts"
}).then(function(newsData) {
angular.forEach(newsData.data, function(newsArticle) {
$scope.posts.push(newsArticle);
$scope.whichtitle = $state.params.aId;
});
$scope.doRefresh= function() {
$http({
method:"GET",
url: "http://www.maixandsandy.com/wp-json/wp/v2/posts"
}).then(function(newsData) {
$scope.posts = newsData.data;
$scope.$broadcast('scroll.refreshComplete');
});
}
})
$scope.myGoBack = function() {
$ionicHistory.goBack();
};
$scope.loadMore = function() {
var parameters = {};
$http.get('http://www.maixandsandy.com/wp-json/wp/v2/posts', { params: parameters }).success(function(items) {
angular.forEach(items, function(item) {
$scope.posts.push(item);
});
$scope.$broadcast('scroll.infiniteScrollComplete');
});
};
});