glowingbear-mainbox/js/file-change.js

24 lines
574 B
JavaScript
Raw Normal View History

2015-10-09 13:50:55 +02:00
(function() {
'use strict';
var weechat = angular.module('weechat');
weechat.directive('fileChange', ['$parse', function($parse) {
return {
restrict: 'A',
link: function ($scope, element, attrs) {
var attrHandler = $parse(attrs.fileChange);
var handler = function (e) {
$scope.$apply(function () {
attrHandler($scope, { $event: e, files: e.target.files });
});
};
element[0].addEventListener('change', handler, false);
}
};
}]);
})();