This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
feat(ngModelOptions): support for easily debouncing default
only
#15411
Closed
gkalpak opened this issue
Nov 18, 2016
· 3 comments
· Fixed by angular-indonesia/angular.js#88 or javascript-indonesias/angular.js#32
Closed
feat(ngModelOptions): support for easily debouncing default
only
#15411
gkalpak opened this issue
Nov 18, 2016
· 3 comments
· Fixed by angular-indonesia/angular.js#88 or javascript-indonesias/angular.js#32
Labels
Milestone
Comments
I believe we can do this without a BC if we fallback on |
petebacondarwin
added a commit
to petebacondarwin/angular.js
that referenced
this issue
Nov 18, 2016
This change enables the use of a `"*"` key in the `debounce` setting of `ngModelOptions`, which will set the debounce value for all events that do not have an explicit value. Closes angular#15411
3 tasks
This would fix most of the issue (i.e you would still need and extra |
OK, in which case we will need a BC and it should be done in 1.7 |
Narretz
added a commit
to Narretz/angular.js
that referenced
this issue
Nov 21, 2017
…ce catch-all Closes angular#15411 BREAKING CHANGE: the 'default' key in 'debounce' now only debounces the default event, i.e. the event that is added as an update trigger by the different input directives automatically. Previously, it also applied to other update triggers defined in 'updateOn' that did not have a corresponding key in the 'debounce'. This behavior is now supported via a special wildcard / catch-all key: '*'. See the following example: Pre-1.7: 'mouseup' is debounced by 500 milliseconds because 'default' is applied. ``` ng-model-options="{ updateOn: 'default blur mouseup', debounce: { 'default': 500, 'blur': 0 } } ``` 1.7: 'mouseup' is debounced by 1000 milliseconds because '*' is applied. ``` ng-model-options="{ updateOn: 'default blur mouseup', debounce: { 'default': 500, 'blur': 0, '*': 1000 } } ```
3 tasks
Narretz
added a commit
to Narretz/angular.js
that referenced
this issue
Nov 21, 2017
…ult' only Closes angular#15411 BREAKING CHANGE: the 'default' key in 'debounce' now only debounces the default event, i.e. the event that is added as an update trigger by the different input directives automatically. Previously, it also applied to other update triggers defined in 'updateOn' that did not have a corresponding key in the 'debounce'. This behavior is now supported via a special wildcard / catch-all key: '*'. See the following example: Pre-1.7: 'mouseup' is debounced by 500 milliseconds because 'default' is applied. ``` ng-model-options="{ updateOn: 'default blur mouseup', debounce: { 'default': 500, 'blur': 0 } } ``` 1.7: 'mouseup' is debounced by 1000 milliseconds because '*' is applied. ``` ng-model-options="{ updateOn: 'default blur mouseup', debounce: { 'default': 500, 'blur': 0, '*': 1000 } } ```
Narretz
added a commit
to Narretz/angular.js
that referenced
this issue
Nov 21, 2017
…ult' only Closes angular#15411 BREAKING CHANGE: the 'default' key in 'debounce' now only debounces the default event, i.e. the event that is added as an update trigger by the different input directives automatically. Previously, it also applied to other update triggers defined in 'updateOn' that did not have a corresponding key in the 'debounce'. This behavior is now supported via a special wildcard / catch-all key: '*'. See the following example: Pre-1.7: 'mouseup' is also debounced by 500 milliseconds because 'default' is applied: ``` ng-model-options="{ updateOn: 'default blur mouseup', debounce: { 'default': 500, 'blur': 0 } } ``` 1.7: The pre-1.7 behavior can be re-created by setting '*' as a catch-all debounce value: ``` ng-model-options="{ updateOn: 'default blur mouseup', debounce: { '*': 500, 'blur': 0 } } ``` In contrast, when 'default' is used, 'blur' and 'mouseup' are not debounced: ``` ng-model-options="{ updateOn: 'default blur mouseup', debounce: { 'default': 500 } } ```
Narretz
added a commit
to Narretz/angular.js
that referenced
this issue
Nov 21, 2017
…ult' only Closes angular#15411 BREAKING CHANGE: the 'default' key in 'debounce' now only debounces the default event, i.e. the event that is added as an update trigger by the different input directives automatically. Previously, it also applied to other update triggers defined in 'updateOn' that did not have a corresponding key in the 'debounce'. This behavior is now supported via a special wildcard / catch-all key: '*'. See the following example: Pre-1.7: 'mouseup' is also debounced by 500 milliseconds because 'default' is applied: ``` ng-model-options="{ updateOn: 'default blur mouseup', debounce: { 'default': 500, 'blur': 0 } } ``` 1.7: The pre-1.7 behavior can be re-created by setting '*' as a catch-all debounce value: ``` ng-model-options="{ updateOn: 'default blur mouseup', debounce: { '*': 500, 'blur': 0 } } ``` In contrast, when only 'default' is used, 'blur' and 'mouseup' are not debounced: ``` ng-model-options="{ updateOn: 'default blur mouseup', debounce: { 'default': 500 } } ```
This was referenced Nov 21, 2017
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Do you want to request a feature or report a bug?
Feature.
What is the current behavior?
The delay specified in an
ngModelOptions
'debounce.default
property will be used as a "catch-all" value, debouncing allupdateOn
events that don't explicitly specifiy a debounce delay.If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (template: http://plnkr.co/edit/tpl:yBpEi4).
Demo
What is the expected behavior?
debounce.default
should only apply to thedefault
event.For a "catch-all" delay, we could use the
'*'
property, which is similar to how it is used for defining inheritance inngModelOptions
. E.g.What is the motivation / use case for changing the behavior?
The current behavior can be confusing, since
updateOn
supports a special event,default
which means the default input event for that input/browser. With the proposed change, it will be still possible to provide a "catch-all" delay (via'*'
) anddebounce.default
will only affect thedefault
event, which is more intuitive. Additionally, it will be easier to apply debouncing on thedefault
event only, without having to explicitly set delays for all other supported events.Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.
Probably 1.3+.
The text was updated successfully, but these errors were encountered: