Angular 2: Debounce (ngModelChange)?

Discussão em 'Angular' iniciado por mtyson, Dezembro 23, 2024.

  1. mtyson

    mtyson Guest

    Is there a way to debounce the template directive (ngModelChange)?

    Or, alternatively, what is the least-painful way to do it a different way?

    The closest answer I see is this: How to watch for form changes in Angular 2?

    So, for example, I have a text input, I want to get onChange updates, but I want to debounce it down from every keystroke:

    <input type="text" class="form-control" placeholder="Enter a value" name="foo" [(ngModel)]="input.event.value" (ngModelChange)="onFieldChange($event, input)">


    Debounce onFieldChange()

    Continue reading...

Compartilhe esta Página