stackfull / angular-virtual-scroll

Source for the sf.virtualScroll module for AngularJS
MIT License
262 stars 42 forks source link

AtEnd event needed #5

Closed stsvilik closed 11 years ago

stsvilik commented 11 years ago

Is it possible to add an event broadcast that fires when source of data is at or near the end (threshold configurable)? This way you can also make this repeater "infinite" since now you can append more data to the source once the end is reached/approaches - think ajax based pagination.

stackfull commented 11 years ago

Could probably do with adding some more events than just AtEnd.

If you want infinite scroll, I've heard good things about this: https://github.com/BinaryMuse/ngInfiniteScroll

stsvilik commented 11 years ago

I intend to use this on mobile devices where the cropping of elements from top/bottom is essential for performance thats why I think your implementation is much better :). So the only thing is missing is those events that could let me know when I'm approaching the end of my data source. P.S. What you did is great and very useful - keep up the good work ;)

stackfull commented 11 years ago

I've been thinking a bit more about this and now that the state variables are exposed (using ngModel), it shouldn't be necessary to add events. Simply watch the model and when model.firstVisible + model.visible === model.total, there is your end event.

stsvilik commented 11 years ago

I'll try that - thanks. Is that on your latest branch?

stackfull commented 11 years ago

It should be in the 0.4.0 release (so getting the latest via bower will work), but also on the master.

stackfull commented 11 years ago

Example added to the demo in 3ec84af23b69810e9bce16446eb31a9af642a16d