【发布时间】:2014-04-26 17:44:07
【问题描述】:
我正在为 android 开发一个应用程序,我使用了一个名为“Ionic Framework”的框架。这是我的问题,我必须制作一个具有“ion-infinite-scroll”的无限滚动系统框架的系统。
当我在我的电脑上的 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>
【问题讨论】:
-
这个
if(false)是误会还是? -
这只是为了测试代码,如果它是真的变量 $scope.noMoreItemsAvailable = true;循环停止
-
你确定这是你的全部
view.html吗?顶部缺少<ion-list>标签。还有什么吗?
标签: javascript android angularjs cordova ionic-framework