Live data from Hacker News

Smarty: An Autocomplete UI in AngularJS

thumbtack.com

11–20 of 22 posts

Re: Smarty: An Autocomplete UI in AngularJS

#13
My company did a fairly thorough review of the open options in this space and settled on select2, which has a handy angular support library here: https://github.com/angular-ui/ui-select2. This isn't the most performant one (twitter's typeahead was for the ones we looked at) but it has a lot of great features, nice look and feel, and not terrible graceful degradation.

Re: Smarty: An Autocomplete UI in AngularJS

#14
post #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!

I too am a fan of the UI Bootstrap typeahead - it's simple, and works nicely. It's not as robust as select2 or whatnot though as you've pointed out.

Re: Smarty: An Autocomplete UI in AngularJS

#15

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.

We use Twitter's typeahead (not the one in bootstrap, separate project), pretty pleased with it: http://twitter.github.io/typeahead.js/

Re: Smarty: An Autocomplete UI in AngularJS

#16
Could do a few things more the Angular way.

- Use ng-keydown on the input field (less overhead than $scope.$watch)

- $http.get has a built in promise. No need to build another one on top of it.

- No need to splice the response, just pass the whole array and use the "limitTo" filter on the results.

Post reply on HN