Search code examples
angularinfinite-scroll

Infinite scroll for Angular 13.3.10


I can't seem to find any infinite scroll libraries for Angular 13.3.10. Could someone please explain how I may make an infinite scroll that loads components rather than images?

I tried using ngx-infinite-scrol


Solution

  • Use the Angular Material SDK. You could render a list and pass the item prop as input to a custom component to render that item.

    <cdk-virtual-scroll-viewport itemSize="50" class="example-viewport">
      <div *cdkVirtualFor="let item of items" class="example-item">
        <custom-component [item]="item"></custom-component>
       </div>
    </cdk-virtual-scroll-viewport>