Scroll down to load more
hieugie opened this issue · 0 comments
hieugie commented
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',
}