lorenzofox3 / lrInfiniteScroll

directive to register handler when an element is scrolled down near its end http://lorenzofox3.github.io/lrInfiniteScroll/index.html
217 stars 46 forks source link

Trouble getting scroll event #4

Open sodacrackers opened 10 years ago

sodacrackers commented 10 years ago

module looks great- thank you. Having difficulty getting element.bind('scroll', function () { working. Module loads and line read; scrolling does not trigger function though. Can't get any element scrolling to trigger bound scroll function. Using: <div class="search-grid container-fluid" ng-class="{starred: currentSearch.starred}" lr-infinite-scroll="loadMore()" scroll scroll-threshold="200" time-threshold="200" >

lorenzofox3 commented 10 years ago

hello,

maybe scoping issue, your attribute scroll create an isolated scope ? Also, I have not tried with angular 1.3 release candidate, so you could try with 1.2.x.

If it does not work try to provide a plunker or any running example.

Thanks.

orszaczky commented 9 years ago

Not sure if we ran into the same issue.

In my tests handler always evaluated to noop, so the function never got called. To get it working without an isolate scope, I used $apply() directly in the promise timeout function, which $eval()s its argument against the scope.

I made a pull request with my solution: https://github.com/lorenzofox3/lrInfiniteScroll/pull/5

awdyson commented 9 years ago

The change @orszaczky proposed worked for me as well. Using angular 1.3 by the way.