I have defined template
@Component({
selector: 'name',
directives: [ ... ],
templateUrl: 'name.html'
})
and class
export class ProductGridComponent implements OnInit {
@HostListener('scroll', ['$event'])
onScroll(e) {
alert(window.pageYOffset)
}
products = [];
}
But it does not shot anything , however when i replace scroll and onScroll with click and onClick it indeed show the alert.
Why does not it work with scroll , does angular2 has any other implementation for it?
Thanks