This should work in your case :
import { fromEvent } from 'rxjs';
import { map, filter, debounceTime, tap, switchAll } from 'rxjs/operators';
const obs = fromEvent(this.el.nativeElement, 'keyup')
.pipe (
map((e:any) => e.target.value), // extract the value of the input
// filter((text:string) => text.length > 1), //filter out if empty
debounceTime(250), //only search after 250 ms
tap(() => this.loading.emit(true)), // Enable loading
// search, call the search service
map((query:string) => this.youtube.search(query)) ,
// discard old events if new input comes in
switchAll()
// act on the return of the search
)
Hope it helps !
EDIT
Here is a working demo on Stackblitz: Demo Angular 6 + Rxjs 6