我有一個代碼。我正在嘗試應用infinte滾動,但它沒有執行。如何在angularjs中使用infinte scroll?
任何人都可以幫助我解決這個問題。它顯示所有的數字,即使我向下滾動它的表現不像infine scrol。
//HTml file
<style>
#fixed {
height: 400px;
overflow: auto;
}
</style>
<body ng-controller="controller">
<div id="fixed" infinite-scroll="scrolling()" infinite-scroll-distance='2'>
<li ng-repeat="i in items" >{{i.id}}</li>
<img src="http://jimpunk.net/Loading/wp-content/uploads/loading1.gif" ng-hide="!showLoader"/>
</div>
</body>
</html>
//js file
var app=angular.module("myapp",['infinite-scroll']);
app.controller("controller",['$scope',function($scope){
$scope.items=[];
var counter=0;
$scope.showloader=false;
$scope.scrolling=function(){
for(var i=0;i<500;i++)
{
$scope.items.push({id:counter});
counter++;
/*console.log({{items}});*/
}
$scope.showloader=true;
};
$scope.scrolling();
}]);
檢查出: - >> https://github.com/sroze/ngInfiniteScroll –
是的,我做了同樣的鏈接... IAM無法獲取infinte滾動。 –