Skip to content

Instantly share code, notes, and snippets.

@robozavri
Created March 2, 2021 13:17
Show Gist options
  • Save robozavri/b0cab29e19678fda3b78c8075c1b185d to your computer and use it in GitHub Desktop.
Save robozavri/b0cab29e19678fda3b78c8075c1b185d to your computer and use it in GitHub Desktop.
#angular #scroll detect bottom on scroll
<div (scroll)="onScroll($event)">
...
...
</div>
import { Component, HostListener } from '@angular/core';
...
...
@HostListener('scroll', ['$event'])
onScroll(event: any) {
// visible height + pixel scrolled >= total height
if (event.target.offsetHeight + event.target.scrollTop >= event.target.scrollHeight) {
console.log("End");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment