Open hieugie opened 9 years ago
Let's see my code below Did i do something wrong ?
<div class="container" ng-controller="gridController" when-scrolled="loadMore()"> <div deckgrid source="photos" cardTemplate="templates/card.html" class="deckgrid" ></div> </div>
studiouskids.directive('whenScrolled', function() { return function(scope, elm, attr) { var raw = elm[0]; elm.bind('scroll', function() { if (raw.scrollTop + raw.offsetHeight >= raw.scrollHeight) { scope.$apply(attr.whenScrolled); } }); }; });
$scope.loadMore = function() { $scope.photos.push({id: 'photo-1', title: 'Photo', src: 'http://lorempixel.com/400/300/abstract', }
Let's see my code below Did i do something wrong ?
studiouskids.directive('whenScrolled', function() { return function(scope, elm, attr) { var raw = elm[0]; elm.bind('scroll', function() { if (raw.scrollTop + raw.offsetHeight >= raw.scrollHeight) { scope.$apply(attr.whenScrolled); } }); }; });
$scope.loadMore = function() { $scope.photos.push({id: 'photo-1', title: 'Photo', src: 'http://lorempixel.com/400/300/abstract', }