mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-05-07 04:47:45 +02:00
add mt-scroll directive to listen scroll event of element
This commit is contained in:
23
modules/core/client/directives/mt-scroll.client.directive.js
Normal file
23
modules/core/client/directives/mt-scroll.client.directive.js
Normal 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});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}());
|
||||
Reference in New Issue
Block a user