The problem is in restrict
parameter. In your example the directive is restricted to element name, but you are actually using it as CSS class ("watch-scrolling"
).
Correct:
app.directive('watchScrolling', function(){
return {
restrict: 'C',
link: function(scope, elem, attr, ctrl) {
console.log('Linked');
elem.bind('scroll', function(e) {
console.log('scrolling');
});
}
};
});