Angular.js: Debounced ng-model-options in v1.6.* fires $digests on each keypress (worked fine in v1.5.*)

Created on 15 Jun 2017  路  7Comments  路  Source: angular/angular.js

I'm submitting a ...

  • [x] bug report
  • [ ] feature request
  • [ ] other (Please do not submit support requests here (see above))

Current behavior:

Video here: https://www.screencast.com/t/TFhK7wyaG !!!
Angular 1.6.* - with ng-model-options="{debounce:1000}" fires $digest cycles on each keypress.
Angular 1.5.* - works perfect!
https://codepen.io/anon/pen/BZQQMG?editors=1010
https://codepen.io/anon/pen/EXNNqN?editors=1010

Expected / new behavior:

ng-model-options should work in Angular 1.6.* as it worked in Angular 1.5.*.

Minimal reproduction of the problem with instructions:

Angular version: 1.6.* has bug (worked fine in 1.5.*)

Browser: [all]

Anything else:

forms

Most helpful comment

Guys, stop commenting with +1 - this is what the reactions are for.

All 7 comments

+1

+1

+1

Guys, stop commenting with +1 - this is what the reactions are for.

I think this was caused by https://github.com/angular/angular.js/commit/c9dffde1cb167660120753181cb6d01dc1d1b3d0#diff-7e6919ccdaa77645580e865e271080eeR89. That catch(noop) stops the cancelled timeout from being treated as an "unhandled error", but now the rejected promise needs to schedule that noop to be executed which triggers the digest. Previously the rejected promise had no handlers so nothing would be scheduled.

@jbedard Thanks for investigating. This looks like the most likely culprit. I have no idea how to fix this, though. Maybe we can special case a noop callback?

I thought of that (special case for noop), but but would be a bit of a breaking change to $q.

Only other thing I've thought of is creating a (private, for now) markExceptionHandled(promise) method.

Was this page helpful?
0 / 5 - 0 ratings