Scroll event in AngularJS

后端 未结 3 1965
隐瞒了意图╮
隐瞒了意图╮ 2021-01-05 07:34

I have a div with a scrollbar in it. Now I want to get an event, that triggers every time, the user scrolls.

Is that possible in AngularJS, or do I have to use jQue

3条回答
  •  爱一瞬间的悲伤
    2021-01-05 08:24

    Sergey's answer helped me a little, but what ended up working for me was this:

    .directive("scroll", function ($window) {
       return {
          link: function() {
             angular.element($window).bind("wheel", function() {
                console.log('Scrolling');
             });
          }
       }
    })
    

提交回复
热议问题