Typeahead: Wikipedia example is not working at http://plnkr.co

Dear developers,

At first I want to tank you for providing such nice library for Angular 2+ and Bootstrap 4.

I’m trying to use “Typeahead” component but I noticed that “Wikipedia” example didn’t work on http://plnkr.co while the same example worked on your demo page.

I’ve never used this component so it’ll be very useful for me to be able to see a working example.

Kind regards
Georgi

1 possible answer(s) on “Typeahead: Wikipedia example is not working at http://plnkr.co

  1. I’ve faced with similar error (ERROR TypeError: Cannot read property ‘lift’ of undefined).

    For me it was because the search function has not returned anything however it should. There are no curly brackets ({}) in the example in the arrow function so it returns the value of the only expression. However, I’ve surrounded the function body with {} but not prefixed with return.

    So here is my answer in ‘code language’:

    Before: (mine, wrong)

    search = (text$: Observable<string>) => {
        text$
          .debounceTime(300)
          ...
          .merge(this.hideSearchingWhenUnsubscribed);
    }

    After: (corrected; instead you can also use it without curly brackets and then you can skip the return keyword)

    search = (text$: Observable<string>) => {
        return text$
          .debounceTime(300)
          ...
          .merge(this.hideSearchingWhenUnsubscribed);
    };