I have this element that I\'m referencing by Id:
let infiniteScrollElement = document.getElementById(\'th-infinite-scroll-tracker\');
I
I think that all you want to do is detect the position of scroll.
@HostListener("window:scroll", ["$event"])
onWindowScroll() {
//In chrome and some browser scroll is given to body tag
let pos = (document.documentElement.scrollTop || document.body.scrollTop) + document.documentElement.offsetHeight;
let max = document.documentElement.scrollHeight;
// pos/max will give you the distance between scroll bottom and and bottom of screen in percentage.
if(pos == max ) {
//Do your action here
}
}
Also don't forget to import HostListener from @angular/core.