Reset input

This commit is contained in:
Kyle Spearrin 2017-07-12 14:17:33 -04:00
parent 94e4ea656e
commit 170aac94d2
1 changed files with 8 additions and 1 deletions

View File

@ -37,7 +37,8 @@ angular
return;
}
var files = document.getElementById('file').files;
var fileEl = document.getElementById('file');
var files = fileEl.files;
if (!files || !files.length) {
toastr.error(i18nService.selectFile, i18nService.errorsOccurred);
return;
@ -54,6 +55,12 @@ angular
});
$analytics.eventTrack('Added Attachment');
toastr.success(i18nService.attachmentSaved);
// reset file input
// ref: https://stackoverflow.com/a/20552042
fileEl.type = '';
fileEl.type = 'file';
fileEl.value = '';
}, function (err) {
if (err) {
toastr.error(err);