angularjs - loadMore() is not being called on browser scroll in ngInfiniteScroll -
i trying implement infinite scroll angularjs app. acquainted usage of nginfinitescroll
i using same example given in demos
page. not working me,
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> <!-- other code --> <ul infinite-scroll='loadmore()' infinite-scroll-distance='1' > <div ng-repeat="item in images">item number {{$index}}: {{$item}}</div> </ul> <!-- 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 = 1; <= 2; i++) { $scope.images.push(last + i); } };
the alert("called")
not being called on browser scroll. can me wrong or how can achieve infinite scroll?
how did defined angular module , controller ?
=> must inject "infinite-scroll" dependecy in module.
=> must defined "infinitescroll" controller in module.
"loadmore" function had in "infinitescroll" controller.
Comments
Post a Comment