-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Angular 1.3.0 RC5 breaks angular-file-upload (RC4 worked fine) #272
Comments
Seems to be caused by angular/angular.js#2973 / angular/angular.js@7b6c1d0 |
Please post the entire stack trace so we can see how angular/angular.js@7b6c1d0 is implicated, if it is at all |
Better yet a reproduction |
Uncaught TypeError: undefined is not a function angular.js:8569 |
https://github.com/nervgh/angular-file-upload/blob/master/angular-file-upload.js#L408 is calling the function without headers --- it probably shouldnt be calling transform functions at all, $http should be doing that for you. Unless you can emulate the headers object, don't do it |
@caitp A fix would be simple to make Angular robust against that (probably wrong) behaviour (hoeni/angular.js@40a40b4) but I'm struggling getting the pull request right (never done that before...) |
A fix would be to call |
This is a bug in angular-file-upload, so that's a relief =) |
@caitp So thanks for your investigation! |
I had this problem too, after update to angular 1.3 uploader stopped working with same error ( |
So what is the solution? :) Can't seem to understand it.. |
Pass the header getter function |
Can you exactly say what to do for dumbs like me ? |
In pseudo code:
|
so, the code from angular for creating the headersFn is this: function headersGetter(headers) {
var headersObj = isObject(headers) ? headers : undefined;
return function(name) {
if (!headersObj) headersObj = parseHeaders(headers);
if (name) {
return headersObj[lowercase(name)] || null;
}
return headersObj;
};
} And the code for parsing responseHeaders is this: function parseHeaders(headers) {
var parsed = {}, key, val, i;
if (!headers) return parsed;
forEach(headers.split('\n'), function(line) {
i = line.indexOf(':');
key = lowercase(trim(line.substr(0, i)));
val = trim(line.substr(i + 1));
if (key) {
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
}
});
return parsed;
} where |
Is this fix going to be added in the main version? That would be great.. |
Thanks! Fixed. |
Could you bump the depency in bower.json to allow angular 1.3 without warning? |
Hi,
until AngularJS 1.3.0-rc.4 the file upload was working perfect for me. Since AngularJS 1.3.0-rc.5 and in the brand new 1.3.0 release it's broken:
My callbacks for
onSuccessItem
andonCompleteItem
are not called anymore, instead I get aUncaught TypeError: undefined is not a function
message on the console, tracing back to adefaultHttpResponseTransform
method in Angular's$HttpProvider
.I'd really love to use this great module with Angular 1.3...
The text was updated successfully, but these errors were encountered: