每次用户接近底部时,我需要加载包含600个项目的20个项目。我以这种方式使用onscroll,但它不识别角度函数,在本例中为loadMore():
<body>
<div ng-app="myApp" ng-controller="customersCtrl">
<div id="tabla" onscroll="loadMore()">
<table>
<tr ng-repeat="x in city | limitTo: limit:begin">
<td> {{ $index +1 }} </td>
<td> {{ x.city }} </td>
</tr>
</table>
</div>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$scope.limit = 20;
$http.get('city.json').then(function (response) {
$scope.city = response.data;
});
$scope.loadMore= function(){
$scope.limit = $scope.limit+20;
}
});
</script>
</body>
</html>
所以,我收到了这个错误:
ReferenceError:未定义loadMore