0

According to this https://github.com/angular/angular.js/issues/1159

this should work, shouldn't it?

el.bind('keyup', function() {       
    var canceler = $q.defer();
    $http.post('/api', data, {timeout: canceler.promise}).success(success);
    canceler.resolve();
});

because it doesn't fire the request at all, no errors or anything, could it be because it's inside a bind function?

3
  • Yes, if you are running 1.1.5 or greater. Otherwise, you the other work around listed in the link you provided. Commented Jul 2, 2013 at 19:02
  • I'm running 1.1.5 it still doesn't fire the request at all. Commented Jul 2, 2013 at 19:03
  • then i'd contact the creator (as you already did on that forum) or use the work around that is provided on that same forum post. Commented Jul 2, 2013 at 19:05

1 Answer 1

1

it indeed was because it's inside the nonangular bind() event, putting scope.$apply() after http and before resolve will fix it

https://github.com/angular/angular.js/issues/1159#issuecomment-20368490

el.bind('keyup', function() {       
    var canceler = $q.defer();
    $http.post('/api', data, {timeout: canceler.promise}).success(success);
    scope.$apply();
    canceler.resolve();
});
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.