Skip to content

Commit 664add5

Browse files
committed
Use scope.evalAsync to make sure the digest cycle is triggered.
1 parent 08a5d5c commit 664add5

File tree

4 files changed

+12
-16
lines changed

4 files changed

+12
-16
lines changed

blueimp-file-upload.jquery.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blueimp-file-upload",
3-
"version": "9.4.0",
3+
"version": "9.4.1",
44
"title": "jQuery File Upload",
55
"author": {
66
"name": "Sebastian Tschan",

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blueimp-file-upload",
3-
"version": "9.4.0",
3+
"version": "9.4.1",
44
"title": "jQuery File Upload",
55
"description": "File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.",
66
"keywords": [

js/jquery.fileupload-angular.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload AngularJS Plugin 2.1.0
2+
* jQuery File Upload AngularJS Plugin 2.1.1
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2013, Sebastian Tschan
@@ -36,16 +36,12 @@
3636
// for the fileUpload directive and default handlers for
3737
// File Upload events:
3838
.provider('fileUpload', function () {
39-
var scopeApply = function () {
39+
var scopeEvalAsync = function (expression) {
4040
var scope = angular.element(this)
41-
.fileupload('option', 'scope')(),
42-
$timeout = angular.injector(['ng'])
43-
.get('$timeout');
44-
// Safe apply, makes sure $apply is called
45-
// asynchronously outside of the $digest cycle:
46-
$timeout(function () {
47-
scope.$apply();
48-
});
41+
.fileupload('option', 'scope')();
42+
// Schedule a new $digest cycle if not already inside of one
43+
// and evaluate the given expression:
44+
scope.$evalAsync(expression);
4945
},
5046
addFileMethods = function (scope, data) {
5147
var files = data.files,
@@ -143,9 +139,9 @@
143139
data.handleResponse.call(that, e, data);
144140
});
145141
},
146-
stop: scopeApply,
147-
processstart: scopeApply,
148-
processstop: scopeApply,
142+
stop: scopeEvalAsync,
143+
processstart: scopeEvalAsync,
144+
processstop: scopeEvalAsync,
149145
getNumberOfFiles: function () {
150146
var scope = this.scope();
151147
return scope.queue.length - scope.processing();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blueimp-file-upload",
3-
"version": "9.4.0",
3+
"version": "9.4.1",
44
"title": "jQuery File Upload",
55
"description": "File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.",
66
"keywords": [

0 commit comments

Comments
 (0)