I would like to use virtual scroll on my Angular application. The items in my list are the result of a remote paged search. I would like to load more results (call the next page
The easiest way to solve this is with the scrolledIndexChange.
$event is the first index of rendered elements at the moment. Therefore, you can call the next page when the index of the first item is near the end of the items in the list
Remember that the items have a fixed height (itemSize) so it is easy to identify the amount of elements that are rendered at a time.
e.g.
nextBatch(index) {
if (index + $itemsRenderAtTheMoment === this.items.length - 1) {
this.page ++;
this.loadMore();
}
}