Skip to content

Commit c0a3a67

Browse files
committed
Merge pull request blueimp#3414 from fabiogermann/master
Changed FileUpload add method to use asyncApply to avoid UI blocking …
2 parents 0bbb588 + 7b3464a commit c0a3a67

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

js/jquery.fileupload-angular.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
angular.forEach(data.files, function (file) {
9292
filesCopy.push(file);
9393
});
94-
scope.$apply(function () {
94+
scope.$parent.$applyAsync(function () {
9595
addFileMethods(scope, data);
9696
var method = scope.option('prependFiles') ?
9797
'unshift' : 'push';
@@ -100,7 +100,7 @@
100100
data.process(function () {
101101
return scope.process(data);
102102
}).always(function () {
103-
scope.$apply(function () {
103+
scope.$parent.$applyAsync(function () {
104104
addFileMethods(scope, data);
105105
scope.replace(filesCopy, data.files);
106106
});
@@ -320,9 +320,11 @@
320320
'fileuploadprocessalways',
321321
'fileuploadprocessstop'
322322
].join(' '), function (e, data) {
323-
if ($scope.$emit(e.type, data).defaultPrevented) {
324-
e.preventDefault();
325-
}
323+
$scope.$parent.$applyAsync(function () {
324+
if ($scope.$emit(e.type, data).defaultPrevented) {
325+
e.preventDefault();
326+
}
327+
});
326328
}).on('remove', function () {
327329
// Remove upload methods from the scope,
328330
// when the widget is removed:

0 commit comments

Comments
 (0)