mirror of
https://github.com/moparisthebest/mail
synced 2024-11-10 19:25:03 -05: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);
|
||
|
}
|
||
|
};
|
||
|
});
|