用离子骨架无限觅食(Infinite scolling with ionic framework)

系统教程 行业动态 更新时间:2024-06-14 17:01:34
用离子骨架无限觅食(Infinite scolling with ionic framework)

我正在开发一个Android应用程序,我使用一个名为“Ionic Framework”的框架。 这是我的问题,我必须制作一个具有无限滚动系统框架“离子无限滚动”的系统。

当我在我的电脑上对Chrome进行测试时,尽管我在页面上的位置,我仍然无法停止离子无限滚动 。

如何放置代码以使系统正常工作? 谢谢

调节器

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

I am developing an application for android and I use a framework called "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.

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>

你缺少无限滚动指令的关键属性

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

<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

更多推荐

本文发布于:2023-04-20 18:39:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/4d5a640f2dbd29cb20a03c43a8019d04.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:骨架   离子   Infinite   framework   ionic

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!