Live data from Hacker News

Smarty: An Autocomplete UI in AngularJS

thumbtack.com

1–10 of 22 posts

Re: Smarty: An Autocomplete UI in AngularJS

#2
Angular Bootstrap's Typeahead directive does this job pretty well, although we've had to do some template overriding and funky directives to get the functionality we needed (e.g. switching the results to a different set by clicking an item in the dropdown). Glad to see more alternatives being made out there. Nice job!

Re: Smarty: An Autocomplete UI in AngularJS

#5
One of the most simple and intuitive autocomplete I saw was using Functional Reactive Programming technique.

Here is the autocomplete with AngularJS + RxJS https://github.com/Reactive-Extensions/rx.angular.js/blob/ma...

BaconJS home page showing an autocomplete in less than 15 LOC, http://baconjs.github.io

Re: Smarty: An Autocomplete UI in AngularJS

#8

If you want not use Angular or another other framework, a fully functional autocomplete may be made with 10 lines of JavaScript. See demo: http://www.scriptol.com/javascript/autocomplete.php Adding a scrolling list of choices would requires two or three more lines.

Cool but the demo isn't working in Chrome for me.

It would be nice to wrap something like that in a web component so that it'd be trivial to reuse without a framework.

Re: Smarty: An Autocomplete UI in AngularJS

#10
You can debounce your web calls. Here is an example: http://davidwalsh.name/javascript-debounce-function

This means that you do not make a web call for each keystroke. That is a huge speedup.

I don't know why you would need to leverage Angular to make a typeahead, but it's a nice writeup nonetheless.

Post reply on HN