@mojtabam wrote:
hi
my codeapp.js
$scope.loadMore = function () {$http.get("http://nariasoft.ir/magic/api/get_posts/?offset="+ $scope.offset).
success(function(reponse) {
var newPost = reponse.posts;
newPost.forEach(function (element, index, array) {
element.title = $sce.trustAsHtml(element.title);
element.excerpt = element.excerpt.substr(0,500);
element.excerpt = element.excerpt + "ادامه...";
element.excerpt = $sce.trustAsHtml(element.excerpt);
})
$scope.recent_posts.push(newPost);
console.log(newPost);$scope.$broadcast('scroll.infiniteScrollComplete');
$scope.offset += 10;});
};
home.html
<ion-list can-swipe="true"> <ion-item class="item item-thumbnail-right" " collection-repeat="post in posts"> <img src="{{post.thumbnail}}"> <h2 class="rtl"><span ng-bind-html="post.title"></span></h2> <p class="rtl" ng-bind-html="post.excerpt"></p> <ion-option-button class="button-assertive"><i class="icon ion-star"></i></ion-option-button> </ion-item> </ion-list> <ion-infinite-scroll ng-if="canLoadMore()" on-infinite="loadMore()" > </ion-infinite-scroll> </ion-content>
and result:
Posts: 1
Participants: 1