Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

$http hangs (or something) after being invoked within a Fineuploader method. #2557

Closed
sweisman opened this issue May 1, 2013 · 6 comments
Closed

Comments

@sweisman
Copy link

sweisman commented May 1, 2013

I don't know if this is an Angular or FineUploader problem, but there is a problem in the interaction later versions of Angular with it.

I have a site that uploads files (using FineUploader) within an Angular controller. When the file uploading is done, it then invokes a function that uses $http.post() to upload a standard form.

Until recently, this process worked flawlessly.

I haven't tested it in a few iterations (I'm on 1.1.4 now) but now, after the successful file uploading, I see the $http invocation within the JS debugger and...nothing happens. It hangs.

The uploader object is stored in $scope.uploader.

I originally thought it was a problem with FineUploader, but now I'm not so sure. The form is on a modal. After doing the submit (which fails to complete, hanging on the $http.post() invocation), if I close the modal and then reopen it, the $http.post() call finally completes.

Can someone explain further how $http works, and why it might hang?

@sweisman
Copy link
Author

sweisman commented May 1, 2013

It looks like $scope.apply() after calling the submit method gets the http request going. Not sure why the behavior change, but glad it now works.

@petebacondarwin
Copy link
Contributor

Can you provide some more concrete example of this problem? Perhaps a link to some code?

@aaronfrost
Copy link
Contributor

I can verify the exact same symptoms. I have a method addMoreThings. It gets called once when the Ctrl inits, and then it gets called each time I scroll to the end of the list (think infinite scroll). When the Ctrl loads, the calls works fine. However, when I scroll to the bottom, it fires the http, but no network traffic is logged.

However, as @sweisman mentions, calling a $scope.$apply() forces it to resume.

@sweisman
Copy link
Author

sweisman commented May 2, 2013

In my case, it used to work with older versions. I hadn't tested this
particular function in a while, so I don't know when it stopped working.
But there were other behaviors that changed in 1.0.5, so perhaps there.

In any case, I can understand why I need to $apply() now, because
technically the code is running outside of the controller context (in a
callback for FineUploader). The details are confusing though, because I
would think responding to a message broadcast is IN context, and it still
doesn't work without the $apply() there. Maybe it's a bug.

But since $apply() does the job, I am happy. Especially since Angular kicks
ass in so many ways.

On Wed, May 1, 2013 at 9:59 PM, Aaron Frost notifications@github.comwrote:

I can verify the exact same symptoms. I have a method addMoreThings. It
gets called once when the Ctrl inits, and then it gets called each time I
scroll to the end of the list (think infinite scroll). When the Ctrl loads,
the calls works fine. However, when I scroll to the bottom, it fires the
http, but no network traffic is logged.

However, as @sweisman https://github.com/sweisman mentions, calling a
$scope.$apply() forces it to resume.


Reply to this email directly or view it on GitHubhttps://github.com//issues/2557#issuecomment-17309251
.

@mokesmokes
Copy link

I believe it's related to this: #2371

@btford
Copy link
Contributor

btford commented Aug 24, 2013

As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months.

Please try the newest versions of Angular (1.0.8 and 1.2.0-rc.1), and if the issue persists, comment below so we can discuss it.

Thanks!

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

5 participants