I'm new to angular and rxjs - basically I have a pipe function that takes a few operators, and one of them takes a 'map' with a ternary that is either an empty array or another observable which is a value coming from an http request:
search = (text: Observable<string>) => {
return text.pipe(
debounceTime(200),
distinctUntilChanged(),
map(term => term.length < 3 ? [] : performSearch(text))
);
}
performSearch(searchTerm: Observable<string>): Observable<Object> {
return this.http.get('/api/header-search-results/con').pipe(
map(res => {
console.log(res);
return res;
})
);
}
I know I'm doing something wrong, I just don't know what - I'm getting an error in the browser:
Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays
I'd appreciate any guidance
subscribe()
orasync
? – Ashish Ranjan[ngbTypeahead]="search"
– duxfox--