Skip to content

Commit 1da122f

Browse files
committed
progress fix for angular 1.0.7
1 parent 6e1876b commit 1da122f

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

demo/war/js/angular-file-upload-html5-shim.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ if (window.XMLHttpRequest) {
1212
xhr.setRequestHeader = (function(orig) {
1313
return function(header, value) {
1414
if (header === '__setXHR_') {
15-
value(xhr);
15+
var val = value(xhr);
16+
// fix for angular < 1.2.0
17+
if (val instanceof Function) {
18+
val(xhr);
19+
}
1620
} else {
1721
orig.apply(xhr, arguments);
1822
}

demo/war/js/angular-file-upload-shim.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ if (window.XMLHttpRequest) {
1414
xhr.setRequestHeader = (function(orig) {
1515
return function(header, value) {
1616
if (header === '__setXHR_') {
17-
value(xhr);
17+
var val = value(xhr);
18+
// fix for angular < 1.2.0
19+
if (val instanceof Function) {
20+
val(xhr);
21+
}
1822
} else {
1923
orig.apply(xhr, arguments);
2024
}
@@ -63,7 +67,11 @@ if (window.XMLHttpRequest) {
6367
xhr.setRequestHeader = (function(orig) {
6468
return function(header, value) {
6569
if (header === '__setXHR_') {
66-
value(xhr);
70+
var val = value(xhr);
71+
// fix for angular < 1.2.0
72+
if (val instanceof Function) {
73+
val(xhr);
74+
}
6775
} else {
6876
orig.apply(xhr, arguments);
6977
}

0 commit comments

Comments
 (0)