Requests stuck in pending

3,928 views
Skip to first unread message

Cosmin Cătălin Sanda

unread,
Nov 10, 2013, 5:06:25 PM11/10/13
to ang...@googlegroups.com

I have a very strange issue (or at least it looks strange to me) with AngularJS. On a simple controller I issue 2 independent requests to my NodeJS backend. Very often, one of the requests would end up being stuck in a pending state. Even stranger, sometimes, the response might switch in the sense that the response 1 that should go to request 1 goes to request 2. I can replicate this behavior both in my development environment and on a live production server (so there doesn't seem to be a server configuration issue). I suspect that the issue is with AngularJS, but I cannot seem to understand what it is.

Here is an overview of what I am doing:

appControllers.controller('DashboardController', ['$scope', '$http', function($scope, $http) {
  $http.get('http://localhost:3001/api/report/top/2013-10-01/2013-10-07/10',{
    headers: {
      // Some header authentication
    }
  })
  .success(function(response) {
    // do some stuff
  });

  $http.get('http://localhost:3001/api/report/time/2013-10-01/2013-10-07/daily',{
    headers: {
      // Some header authentication
    }
  })
  .success(function(response) {
    // do some stuff
  });
}]);

Maybe it's worth mentioning that I am making CORS requests to an API server that is not under the same domain as the web application.

Please tell me what I am doing wrong, or how I could fix this issue (I do not want to chain the requests).

I have also tried using resources, with the same result :(

Thank you,

Cosmin

Andrij Shevchun

unread,
Jun 2, 2014, 6:56:17 AM6/2/14
to ang...@googlegroups.com
Hi, 
I have the same issue with $http requests. 
I used Angular 1.0.7 then I need to have ability to cancel $http request and got Angular 1.1.5 after this I run into this problem.
Did you solve this problem?
If you have solution, please share with me.

Thanks,
Andriy

Понеділок, 11 листопада 2013 р. 00:06:25 UTC+2 користувач Cosmin Cătălin Sanda написав:

Cosmin Cătălin Sanda

unread,
Jun 2, 2014, 7:00:28 AM6/2/14
to ang...@googlegroups.com
Hi Andriy,

This happened a while ago, so I don't remember the exact details, but what I can tell you that there's no problem with Angular or with the browser. It was a stupid error on my side, if I remember correctly, it was in the backend. Try to isolate the issue. Sorry that I couldn't be of more help.

Kind Regards,
Cosmin


--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/j049M2Nlc3s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages