Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ngAfterViewInit() {
- const searchLessons$ = fromEvent<any>(this.input.nativeElement, 'keyup')
- .pipe(
- map(event => event.target.value),
- debounceTime(400),
- distinctUntilChanged(),
- // switchMap cancels prior calls.
- switchMap(search => this.loadLessons(search))
- );
- const initialLessons$ = this.loadLessons();
- this.lessons$ = concat(initialLessons$, searchLessons$);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement