Search code examples
angularangular2-formsangular2-directives

Angular 2: Implement search prediction like google


I have a search box.

I want to show suggestion to complete the input inside the search box.

The REST api to match the data and return nearest suggestion is ready and working.

What I am unable to figure out is how to show the match as suggestion inside the text box in a different color. I found a ng2-completer component on npm but it shows suggestions in a dropdown.

I want to show the suggestion inside the drop box itself and on pressing the tab key complete the typed input using the suggestion


Solution

  • You could try Typeahead from ngx-bootstrap. It allows some customization so you should be able to achieve what you want.