Created
March 2, 2021 13:17
-
-
Save robozavri/b0cab29e19678fda3b78c8075c1b185d to your computer and use it in GitHub Desktop.
#angular #scroll detect bottom on scroll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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