Closed itkin closed 8 years ago
+1. Also, it would be great if the scroll reference provide an isBusy() similar to hasNext().
infinite-scroll-disabled='ctrl.candidates.scroll.isBusy() || !ctrl.candidates.scroll.hasNext()'
Hi Gents. The hasPrev() and hasNext() should take care of this by themselves. They don't update until enough data is loaded to provide an accurate answer. Can you explain the use case we're trying to solve here? It should be sufficient to do something like: infinite-scroll-disabled="!list.scroll.hasNext()"
All I want to know is when next and prev is 100% complete.
I would like to do something like:
ctrl.prototype.loadMore = function () {
self.candidatesIsBusy=true;
self.candidates.scroll.next(20).finally(function(){
self.candidatesIsBusy=false;
});
};
infinite-scroll-disabled='ctrl.candidatesIsBusy || !ctrl.candidates.scroll.hasNext()'
To debounce while inflight.
Not currently an option. There's also no obvious use case for disabling infinite scroll because something happens to be loading. hasNext() should be used here.
@leblancmeneses I've run into this as well. Manually throttling when calling scroll.next(n)
has worked fine but obviously isn't ideal.
@katowulf The use case here is that when you scroll to the bottom of a list, we want next()
to be called once and not again until data is done loading. Here's a plunker which uses the demo code from the firebase-util website. You can see that when the scroll distance threshold is hit, it loads many more than just 10 records: http://plnkr.co/edit/WHq2MsZnDbF0usfVTCWg?p=preview
You can see that when the scroll distance threshold is hit, it loads many more than just 10 records
Thanks for this. Sounds like a bug; would be happy to look at a fix if you file this as a separate issue. Cheers.
Actually, never mind. I didn't realize hasNext()
changes value while data is loading. Using infinite-scroll-disabled="!list.scroll.hasNext()"
like you suggested works perfectly. Plunker
Can we please reopen this? The hasNext() is set to "false" before the child_added records are loaded. I presume this is correct behavior so that the code does not keep attempting to load more records. The promise is necessary to allow me to give the user feedback properly
... resolved once all the child have been added / moved / removed
Don't know how to implement this feature nicely, but wanted to submit the idea :-)
thanks for this amazing lib !