Hi
I have created a directive like below:
app.directive('whenScrolled', function ($window, $document, $timeout) {
return {
restrict: 'A',
scope: { onScroll: '&' },
link: function (scope, element, attrs) {
var $myWindow = angular.element($window);
var $myDocument = angular.element($document);
$myWindow.bind('scroll', function () {
//if (!scope.$$phase) then scope.$apply();
if (element[0].scrollTop + element[0].offsetHeight >=
element[0].scrollHeight) {
scope.$apply(attrs.onScroll)
};
});
}
}
});
$apply is not calling the function passed through attrs.onScroll.
Can anybody guess what may be the reason?
Thanks in advance!!!
--
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.