简体   繁体   English

用离子骨架无限觅食

[英]Infinite scolling with ionic framework

I am developing an application for android and I use a framework called "Ionic Framework". 我正在开发一个Android应用程序,我使用一个名为“Ionic Framework”的框架。 Here is my problem I have to make a system with infinite scroll system framework of "ion-infinite-scroll". 这是我的问题我必须制作一个具有无限滚动系统框架“离子无限滚动”的系统。

When I did my tests on Chrome on my pc I have the ion-infinite-scroll that does not stop despite my position on the page. 当我在我的电脑上对Chrome进行测试时,尽管我在页面上的位置,我仍然无法停止离子无限滚动

How do I place my code so the system works? 如何放置代码以使系统正常工作? Thanks 谢谢

Controller 调节器

$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;

};

Repository 知识库

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;

};

View 视图

    <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>

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

you are missing key attributes on your infinite-scroll directive 你缺少无限滚动指令的关键属性

Example here http://codepen.io/aaronksaunders/pen/gDrev 这里的例子http://codepen.io/aaronksaunders/pen/gDrev

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM