mirror of
https://github.com/moparisthebest/mail
synced 2024-08-13 16:43:47 -04:00
21 lines
566 B
JavaScript
21 lines
566 B
JavaScript
'use strict';
|
|
|
|
var ngModule = angular.module('woDirectives');
|
|
|
|
ngModule.directive('keyfileInput', function() {
|
|
return function(scope, elm) {
|
|
elm.on('change', function(e) {
|
|
for (var i = 0; i < e.target.files.length; i++) {
|
|
importKey(e.target.files.item(i));
|
|
}
|
|
});
|
|
|
|
function importKey(file) {
|
|
var reader = new FileReader();
|
|
reader.onload = function(e) {
|
|
scope.importKey(e.target.result);
|
|
};
|
|
reader.readAsText(file);
|
|
}
|
|
};
|
|
}); |