我正在为我的 angularjs 项目使用ngInfiniteScroll依赖项。
每当我再次上下滚动时,它都会复制行。
HTML
<table infinite-scroll="loadMore()" ng-controller="LastBookingsCtrl">
JavaScript
$scope.loadMore = function() {
$http.get("last.php?start=" + $scope.currentLoadIndex)
.then(function (res) {
if (res.data.length > 0) {
var count = 0;
for (var i = 0; i < res.data.length; i++) {
$scope.lastBookings.push(res.data[i]);
count++;
}
$scope.currentLoadIndex += count;
}
});
};
PHP
$start = $_GET['start'];
$query = "SELECT * FROM `performs` ORDER BY id DESC LIMIT ".$start.", 20";