oferh / ng2-completer

Angular 2 autocomplete component
http://oferh.github.io/ng2-completer/
MIT License
347 stars 172 forks source link

Can we use debounceTime to delay search? #335

Open huyngo opened 7 years ago

huyngo commented 7 years ago

Currently, the search trigger on every change of the input. Can we apply something like debounceTime on Rxjs to reduce number of trigger?

Something like this below code:

this.searchField.valueChanges
      .debounceTime(400)
      .distinctUntilChanged()
      .map( term => this.itunes.search(term))
      .subscribe( value => { 
        value.subscribe( other => console.log(other) ) 
      });
oferh commented 7 years ago

there is a debounce mechanism in CtrList that can be controlled by setting the value of pause