Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

Compatibility with AngularJS 1.3 (undefined is not a function in defaultHttpResponseTransform) #2

Closed
manikantag opened this issue Oct 25, 2014 · 8 comments

Comments

@manikantag
Copy link

Hi,

I've similar module in my project. It is working fine until I upgrade to AngularJS 1.3, after which the script is throwing below error:

TypeError: undefined is not a function
    at defaultHttpResponseTransform (http://localhost:9080/js/lib/angular/angular.js:8569:27)
    at http://localhost:9080/js/lib/angular/angular.js:8517:12
    at forEach (http://localhost:9080/js/lib/angular/angular.js:335:20)
    at transformData (http://localhost:9080/js/lib/angular/angular.js:8516:3)
    at transformResponse (http://localhost:9080/js/lib/angular/angular.js:9224:23)
    at processQueue (http://localhost:9080/js/lib/angular/angular.js:12914:27)
    at http://localhost:9080/js/lib/angular/angular.js:12930:27
    at Scope.$eval (http://localhost:9080/js/lib/angular/angular.js:14123:28)
    at Scope.$digest (http://localhost:9080/js/lib/angular/angular.js:13939:31)
    at Scope.$apply (http://localhost:9080/js/lib/angular/angular.js:14227:24)

This could be related to angular/angular.js#2973 (also, report here nervgh/angular-file-upload#272) - not sure though.

Fix for this simple - we need to return headers too from the combinedTplPromise.then function, like below:

combinedTplPromise.then(function(response) {
    return {
        status: response.status,
        data: origGetMethod(url),
        headers: response.headers
        };
});

Hope this will be useful to someone else.

Let me know if you wanted me to open a pull request.

@manikantag
Copy link
Author

To make it useful for @vojtajina gist visitors, I've posted the above fix there too: https://gist.github.com/vojtajina/3354046#comment-1325030

@astik
Copy link
Owner

astik commented Nov 5, 2014

Hi @manikantag ,
I have tried to reproduce your issue on the demo provided with this project. I couldn't reproduce ='(
Also, I'm personnaly working with this module on several internal projects that are working with 1.3 for a while now (tested on multiple RC before the final one).
Can you give me more information on how to reproduce. Reproducing it on the demo would perfect to debug it.

@astik
Copy link
Owner

astik commented Dec 4, 2014

I close this issue as there was no response. Feel free to reopen it if needed.

@astik astik closed this as completed Dec 4, 2014
@astik
Copy link
Owner

astik commented Dec 19, 2014

I reopen the bug as, in fact, there is a bug.
It has been introduced with angulra 1.3.6.
Will check your solution right now =)

@astik astik reopened this Dec 19, 2014
@astik
Copy link
Owner

astik commented Dec 19, 2014

Your solution works perfectly will release soon to fix it.
Thanks a lot for the issue and the solution !

@astik astik closed this as completed in f822715 Dec 19, 2014
@astik
Copy link
Owner

astik commented Dec 19, 2014

Hi @manikantag
You'll find the fix in the latest release 0.1.4.
Thanks again for the help !

@manikantag
Copy link
Author

Oh, thanks. I m struggling to find the scenario where I m getting the issue. In one environment I m not getting, and other I m getting this issue. Any clue in which scenarios this issue is coming? Thanks again.

@astik
Copy link
Owner

astik commented Dec 19, 2014

Have you checked the Angular version ?
Problem trigger with version 1.3.6 and later .... it won't cause any trouble with 1.3.5 and previous version.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants