Joined November 2013
·

Pirmin Schneider

it-agenten
·
Munich
·
·
·

i guess that in the directive you binding to the scroll event of that div. but usually, this one doesn't scroll, unless you have given it a height and it's children do overflow.

i've solved this for me now like this, listening to scroll-event of the window:

link: function(scope, element, attrs) {
var $myWindow = angular.element($window);
$myWindow.bind('scroll', function() {
var elementHeight = element.height();
var scrollAmount = $myWindow.scrollTop();
var delta = 10;
if (elementHeight - (scrollAmount + delta) < 0) {
scope.$apply(attrs.whenScrolled);
}
});
}

still nice article, thank you!

Achievements
19 Karma
0 Total ProTip Views
Interests & Skills