Skip to content
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

It doesn't abort request at all or I need document to use this module #2

Open
east2dd opened this issue Oct 14, 2014 · 1 comment
Open

Comments

@east2dd
Copy link

east2dd commented Oct 14, 2014

This is my Event service factory
suboutSvcs.factory "Event", ($resource, RequestFactory) ->
Event = RequestFactory.createResource {url: "#{api_path}/events/:eventId"}
Event::isBidableBy = (company) ->
this.eventable.bidable and this.eventable.buyer_id isnt company._id
Event

DashboardCtrl = ($scope, $rootScope, $location, Company, Event, $filter, $q) ->
...
$scope.request = null
$scope.loadMoreEvents = ->
$scope.request.abortAll if $scope.request!=null
$scope.request = Event.query queryOptions
...

but it sends request several times whenever i click a button and I get 200 and 304

@Kaspis77
Copy link

Kaspis77 commented Jun 7, 2016

Hello, I also can't get the abort funcnality to work, can You help me to get this to work?

code in controller:

var requests = [];

 $scope.search= function (search) {

            var previousRequest = requests.pop();
            if (previousRequest) {
                previousRequest.abort();
            }

           var res = clientResource.search({'search': search});
           requests.push(res);
           var promise = res.promise;
           promise.then(function (response) {
              requests.pop();
              return response.data;
           });
           return promise;                        
        };

When the previousRequest.abort(); is called it never actually abort the pending xhr. clientResource is RequestFactory object. I am using angular version 1.5.6. Can You please show me the right direction to solve this. Thank You a lot.

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

No branches or pull requests

2 participants