angularjs - Angular js - On scroll up load more data -
i have developed chatting system facebook. want load earlier messages. can me functionality when scroll should load earlier messages same facebook.
you may want take @ nginfinitescroll. module, easy implement want. here example:
<div ng-app='myapp' ng-controller='democontroller'> <div infinite-scroll='loadmore()' infinite-scroll-distance='2'> <img ng-repeat='image in images' ng-src='http://placehold.it/225x250&text={{image}}'> </div> </div> var myapp = angular.module('myapp', ['infinite-scroll']); myapp.controller('democontroller', function($scope) { $scope.images = [1, 2, 3, 4, 5, 6, 7, 8]; $scope.loadmore = function() { var last = $scope.images[$scope.images.length - 1]; for(var = 1; <= 8; i++) { $scope.images.push(last + i); } }; });
if using bower, can install if bower install nginfinitescroll.
Comments
Post a Comment