-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Add typeahead directive #114
Comments
So, as for the design discussion for typeahead, here is a set of features that we should support (IMO):
|
Based on the above assumptions we can imagine the following proposals for the directive's syntax: The simplest possible usage
@ajoslin was suggesting that we use standard filtering and ordering with existing filters like so:
but it would mean that we would have to specify this Source as function
Does anyone has a better proposal for the Filtering and orderingWhile filtering and ordering matches we can assume that we are dealing with an array already (so if a source was a function its results are already resolved).
There are number of other open questions but we need to agree upon principles. |
Could you add select-row and render-row to typeahead, eg: we may passing a array of array as data source, and select the first element of the row, and render each array with second element of the row. |
Did some further work on the typeahead today adding ability to supply a function as source of matches. What is even better is that those functions can return promises (!) and the typeahead should resolve them: This definitively needs more work and I still think how to structure it properly but yeh, here it is, WIP: Once again, I'm amazed how easy is to do things with AngularJS and how powerful the promise API is! |
OK, another (last!) stab at the typeahead syntax, this time making it really AngularJS-like and not at all Bootstrap-JS-like: https://gist.github.com/pkozlowski-opensource/4998969 The only downside I can see is that it has a bit of noise for the simplest possible use case (items from an array). On the other hand it is much simpler for more elaborate use cases. BTW: I think that with this proposal we would be exactly matching functionality of http://engineering.twitter.com/2013/02/twitter-typeaheadjs-you-autocomplete-me.html but reusing the whole AngularJS infrastructure ($q, $http + caching, templates etc.) |
Nice 😄. I like it. And I think the noise is fine - select has the same amount of "noise" for a simple use case too. |
I agree: the noise is not so bad and is worth it for the full power of a filter pipeline. |
One comment: Couldn't Or wait .. people will want different templates for different typeaheads. Nevermind :-) |
Currently we've got 2 PRs opened for the typeahead directive: #57 and #65. @GuillaumeBiton first PR opened my eyes on how easy is to create this directive with AngularJS. I've toggled with different ideas but both proposals need some more discussion and work before merging.
Opening this issue so we can move the discussion to one place, as we've started to discuss things in several places. Going to close both PRs for now till we build consensus around directive's syntax.
The text was updated successfully, but these errors were encountered: