Build fully reactive APIs in Angular 2 with Observables

Share this video with your friends

Send Tweet

In this video you'll learn how Observables can improve the overall API design by designing APIs that accept Observables as arguments

Vitalie Andries
Vitalie Andries
~ 8 years ago

Hi, could you help me with a hint (code are always welcome) how to and another operator (which?) to hold the request (like debounceTime did) until e.g. term.length is > 2.

Thank you.

Andrei Ivanovici
Andrei Ivanovici
~ 8 years ago

Really nice quick course, thank you :). As a last step in the refactoring, maybe we can use the observable directly in the template, using the async pipe. I think that cleans to code eve further and also deals with managing the subscription in our component

vtechmonkey
vtechmonkey
~ 7 years ago

I had to add => to the search function

search = (terms: Observable<string>, debounceMs = 400)=>{
  	return terms
  	.debounceTime(400)
  	.distinctUntilChanged()
  	.switchMap (term => this.rawSearch(term));
  }