add mt-scroll directive to listen scroll event of element

This commit is contained in:
OldHawk
2017-05-10 17:51:02 +08:00
parent 6372e28640
commit 302a9afaf5

View File

@@ -0,0 +1,23 @@
(function () {
'use strict';
angular.module('core')
.directive('mtScroll', mtScroll);
function mtScroll() {
var directive = {
restrict: 'A',
link: link
};
return directive;
function link(scope, element, attrs) {
if (attrs.mtScroll) {
$(element).on('scroll', function (evt) {
scope.$eval(attrs.mtScroll, {$event: event});
});
}
}
}
}());