this is my code directive:
import { Directive, HostListener, ElementRef } from '@angular/core';
@Directive({
selector: '[appScrollToEnd]'
})
export class ScrollToEndDirective {
constructor(private element: ElementRef) { }
@HostListener('scroll') onScroll(){
console.log(this.element
}
}
and in my view template
<div class="content" appScrollToEnd="functionInComponent($event)"></div>
How can i call methods functionInComponent() when scroll. i know angular2 can listen event scroll, but my purpose is call method of component from directive. Thank