title: Using ui-typeahead to populate model with object but show string of that model
body: <p>Hello everyone I have the following code using ui-angular typeahead</p>
  <pre><code>&lt;input type=&quot;text&quot; ng-model=&quot;itemSelected&quot;
             uib-typeahead=&quot;item.name for item in getItems()&quot; id=&quot;itemInput&quot; class=&quot;form-control&quot;&gt;
  </code></pre>
  <p>the data that <code>getItems()</code> returns is of this structure:</p>
  <blockquote>
  <p>[{itemId : 12345, name : &quot;name of item&quot;} ....]</p>
  </blockquote>
  <p>Now what I would like to happen is the type ahead to give it's suggestions by showing <code>item.name</code> (which it currently does!) however what it does is sets itemSelected to the string not the object.</p>
  <p>if I change the html such that the list comprehension reads item for item in <code>getItems()</code> I get the typeahead giving me the object (not what I want) although it does set the itemSelected variable to the object of my selected typeahead.</p>
  <p>I would like the typeahead to display item.name but I would like the object item to be put into <code>itemSelected</code>. How can I achieve that?</p>