How to get on scroll events?

后端 未结 4 1182
礼貌的吻别
礼貌的吻别 2020-12-24 10:31

I need to get scroll events from a div with overflow: scroll in my Angular 2 app.

It seems onscroll event do not works on Angular 2.

How could I achieve that

4条回答
  •  借酒劲吻你
    2020-12-24 11:04

    for angular 4, the working solution was to do inside the component

    @HostListener('window:scroll', ['$event']) onScrollEvent($event){
      console.log($event);
      console.log("scrolling");
    } 
    

提交回复
热议问题