You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

ngx-infinite-scroll

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-infinite-scroll

[![Build Status](https://travis-ci.org/orizens/ngx-infinite-scroll.svg?branch=master)](https://travis-ci.org/orizens/ngx-infinite-scroll) [![Backers on Open Collective](https://opencollective.com/ngx-infinite-scroll/backers/badge.svg)](#backers) [![Sponso

20.0.0
latest
Source
npmnpm
Version published
Weekly downloads
293K
4.17%
Maintainers
1
Weekly downloads
 
Created

What is ngx-infinite-scroll?

The ngx-infinite-scroll package is an Angular directive that allows you to implement infinite scrolling in your Angular applications. It provides a simple way to load more data as the user scrolls down the page, enhancing the user experience by avoiding the need for pagination.

What are ngx-infinite-scroll's main functionalities?

Basic Infinite Scroll

This feature allows you to implement basic infinite scrolling. The `infiniteScroll` directive is added to a container, and the `scrolled` and `scrolledUp` events are used to load more data when the user scrolls down or up, respectively.


<template>
  <div infiniteScroll
       [infiniteScrollDistance]="2"
       [infiniteScrollUpDistance]="1.5"
       [infiniteScrollThrottle]="300"
       (scrolled)="onScrollDown()"
       (scrolledUp)="onScrollUp()">
    <!-- content here -->
  </div>
</template>

<script>
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  onScrollDown() {
    console.log('scrolled down!!');
    // Load more data here
  }

  onScrollUp() {
    console.log('scrolled up!!');
    // Load more data here
  }
}
</script>

Custom Scroll Distance

This feature allows you to customize the scroll distance at which the `scrolled` event is triggered. In this example, the `infiniteScrollDistance` is set to 1, meaning the event will be triggered when the user scrolls to the bottom of the container.


<template>
  <div infiniteScroll
       [infiniteScrollDistance]="1"
       (scrolled)="onScroll()">
    <!-- content here -->
  </div>
</template>

<script>
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  onScroll() {
    console.log('scrolled!!');
    // Load more data here
  }
}
</script>

Throttle Scroll Events

This feature allows you to throttle the scroll events to improve performance. The `infiniteScrollThrottle` input is used to specify the delay in milliseconds between successive scroll events. In this example, the scroll events are throttled to 200 milliseconds.


<template>
  <div infiniteScroll
       [infiniteScrollThrottle]="200"
       (scrolled)="onScroll()">
    <!-- content here -->
  </div>
</template>

<script>
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  onScroll() {
    console.log('scrolled!!');
    // Load more data here
  }
}
</script>

Other packages similar to ngx-infinite-scroll

FAQs

Package last updated on 10 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts