I am using Angular 9 for web development. I wanted to implement typeahead feature in my application. So I am using ng bootstrap typeahead. everything works perfectly as mentioned into below code.
search = (text$: Observable<string>) =>
text$.pipe(
debounceTime(150),
distinctUntilChanged(),
switchMap(term =>
this.GameService.getCode(term).pipe(
catchError(() => {
return of([]);
}))
),
)
but somehow this is not working into the IE browser as it does not have support for arrow functions. To resolve this probem i have modified code in below manner:
search = function(text$: Observable<string>) {
return text$.pipe(
debounceTime(150),
distinctUntilChanged(),
switchMap(term => {
let self = this; // this is undefined and hence self is also undefined
return self.GameService.getCode(term).pipe(
map((res) => {
this.isSearching = false;
return res;
}),
catchError(() => {
return of([]);
}))
}
),
)
}
how do i customize this code to support IE browser.