我正在尝试为我的 angularjs 应用程序实现无限滚动。熟悉ngInfiniteScroll的用法
我正在使用他们演示中给出的相同示例
页。它不适合我,
profile.ejs:
<script src='../controllers/jquery.min.js'></script>
<script src='../controllers/angular.min.js'></script>
<script src='../controllers/ng-infinite-scroll.min.js'></script>
<!-- some other code -->
<ul infinite-scroll='loadMore()' infinite-scroll-distance='1' >
<div ng-repeat="item in images">Item number {{$index}}: {{$item}}</div>
</ul>
<!-- some other code -->
profileController.js
$scope.images = [1, 2, 3, 4, 5, 6, 7, 8];
$scope.loadMore = function() {
alert("called");
var last = $scope.images[$scope.images.length - 1];
for(var i = 1; i <= 2; i++) {
$scope.images.push(last + i);
}
};
浏览器alert("called")
滚动时没有调用。任何人都可以帮助我在哪里出错或如何实现无限滚动?