2014-04-26 1 views
4

나는 안드로이드 용 애플리케이션을 개발 중이며 "이온 프레임 워크"라는 프레임 워크를 사용하고 있습니다. 여기에 내 문제는 "이온 무한 스크롤"의 무한 스크롤 시스템 프레임 워크로 시스템을 만들어야한다는 것입니다.이온 골격을 사용한 무한 스콜링

내 컴퓨터에서 Chrome에 대한 테스트를 수행했을 때 페이지에서 내 위치에도 불구하고 멈추지 않는 ion-infinite-scroll이 있습니다.

시스템이 작동하도록 코드를 어떻게 배치합니까? 감사합니다

컨트롤러

$scope.loadMore = function(){ 
    console.log("LoadMOre"); 



    imageCache.init().then(function() { 
     BonjourTwitterRepository.populate($scope); 
    }); 
    $scope.$broadcast('scroll.infiniteScrollComplete'); 
    $scope.$broadcast('scroll.resize'); 



    console.log($scope.tweetsList); 
    if(false){ 
     console.log("ok"); 
     $scope.noMoreItemsAvailable = true; 

    } 
    $scope.currentIndex = $scope.currentIndex + $scope.perPage; 

}; 

저장소

var populateCollection = function (tweets, $scope) { 
    collection = new TweetCollection(); 
    console.log($scope.currentIndex); 
    for (var i = $scope.currentIndex; i < $scope.perPage; i++) { 
     collection.addTweets(new Tweet(tweets[i], $scope, imageCache)); 

    } 
    $scope.tweetsList = collection; 

}; 

보기

<ion-item class="item item-body"> 
     <div class="item item-image"> 
      <img ng-src="{{tweet.media_url}}" src="img/loading1.gif"/> 
     </div> 
     <p> 
      by : <a href="https//twitter.com/{{tweet.getUsername()}}">@{{tweet.getUsername()}}</a> 
     </p> 

    </ion-item> 
    <div class="item tabs tabs-secondary tabs-icon-left"> 
     <p> 
      <a href="#" class="rating-poll"><i class="icon-thumbs-up"></i></a> 
      <a href="#" class="rating-poll"><i class="icon-thumbs-down"></i></a> 
     </p> 

     <p> 
      <button ng-click="shareThis('{{tweet.media_url}}')" class="button icon button-clear "><i 
        class="icon ion-share"></i>Share 
      </button> 

     </p> 


    </div> 
</ion-list> 
<ion-infinite-scroll></ion-infinite-scroll> 

+0

예 당신의 무한 스크롤 지시에 키 속성이 누락이'(false)를'실수 나에 대한 경우? –

+0

변수 $ scope.noMoreItemsAvailable = true로 true이면 코드를 테스트하기 만하면됩니다. 루프 멈춤 – Flug

+0

전체'view.html'이 확실합니까? 상단에 누락 된 ''태그가 있습니다. 다른게 있니? – potatoes

답변

6
<ion-infinite-scroll 
     on-infinite="fetchTrucks()" 
     distance="10%"> 
</ion-infinite-scroll> 

여기 http://codepen.io/aaronksaunders/pen/gDrev

+0

Aaron 많은 수의 항목이있는 경우 성능 문제가 발생할 수있는 새로운 데이터를로드 할 때 페이지에 div가 무한대로 표시되는 것처럼 보입니다. –

+0

매우 하드로드 예제 ... – alexche8

관련 문제