const ele = this._scrollContent.nativeElement;
ele.addEventListener(‘scroll’, this.handler);
In this handler method I am able to get scroll event but not able to access component variable with this. I want to access variables and methods of component but that context not available with this.
I am trying to create horizontal infinite scroll. I get the condition when it reaches to end with following code. But this refers to that element not to component. I want to call loadData method from component to load new items
handler(event) {
if((event.target.scrollLeft + event.target.clientWidth) == event.target.scrollWidth) {
// horizontal scroll at end load new items
}
}