Skip to content

Instantly share code, notes, and snippets.

@nalaka526
Last active February 23, 2024 21:34
Show Gist options
  • Save nalaka526/c8ee571b2effa6af36a316009656e24c to your computer and use it in GitHub Desktop.
Save nalaka526/c8ee571b2effa6af36a316009656e24c to your computer and use it in GitHub Desktop.
Angular : HTML element detect scroll to bottom
https://stackoverflow.com/a/50038429/153512
<div style="overflow-y: scroll;" (scroll)="onScroll($event)">
content
</div>
import { Component, OnInit, Output, EventEmitter, HostListener } from '@angular/core';
@HostListener('scroll', ['$event'])
onScroll(event: any) {
if (event.target.offsetHeight + event.target.scrollTop >= event.target.scrollHeight - 1) {
// code
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment