Eckig und entprellen

In AngularJS kann ich debounce-ein Modell mit ng-model-options.

ng-model-options="{ debounce: 1000 }"

Wie kann ich die debounce-Modell in Eckig? Ich habe versucht, zu suchen für debounce in die docs, aber ich konnte nichts finden.

https://angular.io/search/#stq=debounce&stp=1

Eine Lösung wäre, zu schreiben, meine eigenen debounce-Funktion, zum Beispiel:

import {Component, Template, bootstrap} from 'angular2/angular2';

//Annotation section
@Component({
  selector: 'my-app'
})
@Template({
  url: 'app.html'
})
//Component controller
class MyAppComponent {
  constructor() {
    this.firstName = 'Name';
  }

  changed($event, el){
    console.log("changes", this.name, el.value);
    this.name = el.value;
  }

  firstNameChanged($event, first){
    if (this.timeoutId) window.clearTimeout(this.timeoutID);
    this.timeoutID = window.setTimeout(() => {
        this.firstName = first.value;
    }, 250)
  }

}
bootstrap(MyAppComponent);

Und meine html -

<input type=text [value]="firstName" #first (keyup)="firstNameChanged($event, first)">

Aber ich bin auf der Suche nach einem build-in-Funktion, ist es eine in Eckige?

InformationsquelleAutor der Frage koningdavid | 2015-08-17

Schreibe einen Kommentar