Changing Our Search to Use Typeahead
Given everything you’ve done up to this point, changing the search from one where you must click a button to one where the search happens as you type will actually be fairly straightforward. Because Angular has allowed us to separate our concerns, you have all the code you need in place. You’ll just need to connect it to the user interface in a different way.
Currently, when the user modifies the contents of the text field, Angular updates the value of keywords in our CustomerSearchComponent class. You can’t directly see it, but it does it as the user types. If you can hook into that behavior, you can perform your search as the user is typing.
Angular provides a way to do this by binding to the ngModelChange ...
Get Rails, Angular, Postgres, and Bootstrap, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.