results: Observable<RedditResult[]>;
search: FormControl = new FormControl('');
constructor(ris: RedditImageSearchService) {
this.results = this.search.valueChanges.pipe(
map(search => search.trim()),
debounceTime(200),
distinctUntilChanged(),
filter(search => search !== ''),
switchMap(search =>
ris.search(search).pipe(
retry(3),
startWith([])
)
)
)
}
Last active
November 12, 2021 07:15
-
-
Save belachkar/64ad6bf906e80aea0c4b028b978912eb to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment