I try to use infinite scroll but … my code doesn’t work Please, help me
part of html
<ion-view view-title="Playlists">
<ion-content>
<ion-list>
<ion-item ng-repeat="item in items">
Item {{item}}
</ion-item>
</ion-list>
<ion-infinite-scroll ng-if="!noMoreItemsAvailable" on-infinite="loadMore()" distance="1%">
</ion-infinite-scroll>
</ion-content>
</ion-view>
and controller
.controller('PlaylistsCtrl', function($scope) {
$scope.items = [];
$scope.noMoreItemsAvailable = false;
$scope.loadMore = function() {
for(x = 0; x < $scope.playlists.length;x++){
$scope.items.push({ title: $scope.playlists[x].title});
if ( $scope.items.length == $scope.playlists.length ) {
$scope.noMoreItemsAvailable = true;
};
$scope.$broadcast('scroll.infiniteScrollComplete');
}};
$scope.playlists = [
{ title: 'Reggae', id: 1 },
{ title: 'Chill', id: 2 },
{ title: 'Dubstep', id: 3 },
{ title: 'Indie', id: 4 },
{ title: 'Rap', id: 5 }]
})