I have tried as given below, but neither window is scrolling nor any method
is getting called:
app.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);
}
});
};});
function LoadMoreItems() {
//angular.extend($scope.items, $scope.allItems.slice($scope.lastCount,
$scope.lastCount + $scope.count));
$scope.temp = $scope.allItems[$scope.lastCount];
$scope.items.push({
Name: $scope.temp.Name,
Price: $scope.temp.Price,
StockStatus: $scope.temp.StockStatus,
Picture: $scope.temp.Picture
});
$scope.temp = $scope.allItems[$scope.lastCount + 1];
$scope.items.push({
Name: $scope.temp.Name,
Price: $scope.temp.Price,
StockStatus: $scope.temp.StockStatus,
Picture: $scope.temp.Picture
});
$scope.lastCount += $scope.count;}
function getAllItemss(cat) {
itemsFactory.getSpecificItems(cat)
.success(function(_items) {
$scope.allItems = _items;
//$scope.items = [];
$scope.lastCount = 0;
LoadMoreItems();
})
.error(function(error) {
$scope.status = 'Unable to load items : ' + error.message;
});}
<div when-Scrolled="LoadMoreItems()"></div>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.