I am using Angular-UI typeahead as follows:
<input type="text" ng-model="myModel" typeahead="o.value as o.text for o in options | filter:$viewValue | limitTo:5" typeahead-editable="false" />
tied to a model like:
var options = [ {"value": 1, "text": "value1"}, {"value": 2, "text": "value2"}, ... ];
It correctly displays the text of the parameters, but when I select an element, it shows the value inside the text field. The model is correctly limited only by the value (and not by the entire model object).
Is it possible to display “text” (rather than “value”) inside the text box after the selection, while retaining the model’s binding only to the value (ie when I select a specific “text”, the model is updated using “value”)?
angularjs angular-ui angular-ui-typeahead
Matteo Piazza Oct 30 '13 at 11:10 2013-10-30 11:10
source share