From dadf63c160890a76250aa297af1b27f913ac2b20 Mon Sep 17 00:00:00 2001 From: danialfarid Date: Sat, 4 Mar 2017 11:33:16 -0800 Subject: [PATCH] Fix #1786 --- src/model.js | 4 ++-- src/validate.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/model.js b/src/model.js index 1f5854e4..c8cbc28a 100644 --- a/src/model.js +++ b/src/model.js @@ -218,8 +218,8 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE if (validateAfterResize) { upload.validate(allNewFiles, keep ? prevValidFiles.length : 0, ngModel, attr, scope) .then(function (validationResult) { - valids = validationResult.validsFiles; - invalids = validationResult.invalidsFiles; + valids = validationResult.validFiles; + invalids = validationResult.invalidFiles; updateModel(); }); } else { diff --git a/src/validate.js b/src/validate.js index 100a3f71..808bcebb 100644 --- a/src/validate.js +++ b/src/validate.js @@ -467,14 +467,14 @@ ngFileUpload.service('UploadValidate', ['UploadDataUrl', '$q', '$timeout', funct el.on('loadedmetadata', success); el.on('error', error); + var count = 0; - function checkLoadError() { $timeout(function () { if (el[0].parentNode) { if (el[0].duration) { success(); - } else if (count > 10) { + } else if (count++ > 10) { error(); } else { checkLoadError();