angular-ui typeahead select id instead of object

TlmaK0 picture TlmaK0 · Jun 3, 2013 · Viewed 13.5k times · Source

I'm trying to set an id in the typeahead instead an object and it doesn't work like a select element.

Here is an example, where you can write the correct word in the typeahead, and then the select element is updated, but if you change the select, the typeahead isn't updated with the name, is updated with the id instead.

http://plnkr.co/edit/LJqdebViiucCv6X5hhtf?p=preview

I'm doing something wrong?

Answer

JakubKnejzlik picture JakubKnejzlik · Jun 14, 2013

What about something like that?

http://plnkr.co/edit/pUPzVK?p=preview (check the typehead and ng-options definition)

What you "did wrong" is missing the info, that typehead doesn't have exactly the same definition as ng-options (I've struggled with this for a while too).

Hope this helps