Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. ngAfterViewInit() {
  2. const searchLessons$ = fromEvent<any>(this.input.nativeElement, 'keyup')
  3. .pipe(
  4. map(event => event.target.value),
  5. debounceTime(400),
  6. distinctUntilChanged(),
  7. // switchMap cancels prior calls.
  8. switchMap(search => this.loadLessons(search))
  9. );
  10.  
  11. const initialLessons$ = this.loadLessons();
  12.  
  13. this.lessons$ = concat(initialLessons$, searchLessons$);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement