Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Typeahead tab/select when using property of object for value. #180

Closed
kloy opened this issue Mar 1, 2013 · 2 comments
Closed

Typeahead tab/select when using property of object for value. #180

kloy opened this issue Mar 1, 2013 · 2 comments
Milestone

Comments

@kloy
Copy link

kloy commented Mar 1, 2013

Here is a plunkr http://plnkr.co/edit/hvyZud

Basically, when using an expression like typeahead="state.value as state.label for state in states | filter:$viewValue" tab and select do not properly update the value of the input with the selected value. This expression is valid in a and I would expect it to work in typeahead as well, and to not have to assign the whole item's object to the model. @pkozlowski-opensource

@pkozlowski-opensource
Copy link
Member

@kloy So, I kind of "fixed" it, have a look here (not yet in master): http://plnkr.co/edit/U4FoDF?p=preview

The trouble here is that on the initial display you will see model's value and not the label, which is something I was trying to explain yesterday. Still, I think it is better as compared to not updating inputs at all.

Just be aware that with such mapping there is not enough info in the model to re-create a label. Have a look and let me know how this works for you.

@mlunoe
Copy link

mlunoe commented Apr 3, 2013

Hi pkozlowski

Looks awesome! I would like to use this to search through some synonyms as well. I've edited your plunker to suit my needs:
http://plnkr.co/edit/P1d26H?p=preview

The weird part is that it does actually search through the synonyms (e.g., try to type "one" to get Alabama to show), but I wanted it to display these synonyms as well, so the user knows that it is showing based on a synonym.

plunker

Maybe I should fork you and see what I could come up with :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants