Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

feat(ngModelOptions): support for easily debouncing default only #15411

Closed
@gkalpak

Description

@gkalpak

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 all updateOn 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 the default event.
For a "catch-all" delay, we could use the '*' property, which is similar to how it is used for defining inheritance in ngModelOptions. E.g.

{
  updateOn: 'default blur keyup keydown',
  debounce: {default: 100, blur: 0, '*': 333}
}

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 '*') and debounce.default will only affect the default event, which is more intuitive. Additionally, it will be easier to apply debouncing on the default 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+.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions