mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
fix infinity scroll
This commit is contained in:
@@ -104,29 +104,34 @@ module.controller('FeedListCtrl', function($scope, $routeParams, $http,
|
||||
|
||||
$scope.limit = 10;
|
||||
$scope.busy = false;
|
||||
$scope.hasMore = true;
|
||||
|
||||
$scope.refreshList = function() {
|
||||
if ($scope.settings.readingMode) {
|
||||
$scope.entryList = EntryService.get({
|
||||
_type : $scope.selectedType,
|
||||
_id : $scope.selectedId,
|
||||
_readtype : $scope.settings.readingMode,
|
||||
type : $scope.selectedType,
|
||||
id : $scope.selectedId,
|
||||
readType : $scope.settings.readingMode,
|
||||
offset : 0,
|
||||
limit : $scope.limit
|
||||
limit : 30
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.loadMoreEntries = function() {
|
||||
if(!$scope.hasMore)
|
||||
return;
|
||||
if (!$scope.entryList || !$scope.entryList.entries)
|
||||
return;
|
||||
if ($scope.busy)
|
||||
return;
|
||||
if (!$scope.settings.readingMode)
|
||||
return;
|
||||
$scope.busy = true;
|
||||
EntryService.get({
|
||||
_type : $scope.selectedType,
|
||||
_id : $scope.selectedId,
|
||||
_readtype : $scope.settings.readingMode,
|
||||
type : $scope.selectedType,
|
||||
id : $scope.selectedId,
|
||||
readType : $scope.settings.readingMode,
|
||||
offset : $scope.entryList.entries.length,
|
||||
limit : $scope.limit
|
||||
}, function(data) {
|
||||
@@ -135,9 +140,8 @@ module.controller('FeedListCtrl', function($scope, $routeParams, $http,
|
||||
for ( var i = 0; i < entries.length; i++) {
|
||||
$scope.entryList.entries.push(entries[i]);
|
||||
}
|
||||
console.log(entries.length)
|
||||
console.log($scope.limit)
|
||||
$scope.busy = false;
|
||||
$scope.hasMore = entries.length == $scope.limit
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ module.factory('EntryService', [
|
||||
}
|
||||
}
|
||||
};
|
||||
res = $resource('rest/entries/:_method/:_type/:_id/:_readtype', {},
|
||||
res = $resource('rest/entries/:_method', {},
|
||||
actions);
|
||||
return res;
|
||||
} ]);
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
{{readType}}
|
||||
<span>{{entryList.name}}</span><span
|
||||
ng-show="selectedType == 'category'"> »</span>
|
||||
<div id="feed-accordion" infinite-scroll="loadMoreEntries()" infinite-scroll-disabled="busy" infinite-scroll-distance="1">
|
||||
<div ng-repeat="entry in entryList.entries">
|
||||
<div class="accordion" id="feed-accordion" infinite-scroll="loadMoreEntries()" infinite-scroll-disabled="busy" infinite-scroll-distance="1">
|
||||
<div ng-repeat="entry in entryList.entries" class="entry">
|
||||
<div class="entry-heading">
|
||||
<a class="accordion-toggle" data-toggle="collapse"
|
||||
ng-click="mark(entry, true)"
|
||||
|
||||
Reference in New Issue
Block a user