Smarty: An Autocomplete UI in AngularJS
thumbtack.com
thumbtack.com
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.
It would be nice to wrap something like that in a web component so that it'd be trivial to reuse without a framework.
- 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.
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
It should really be a directive though, so it adds all the required markup on its own.