I use typeahead in my angularjs project.
I hava this value to be displayed in textbox with typeahead attribute:
$scope.cities = [{id:1,address:'Berlin'},
{id:2,address:'Bonn'},
{id:3,address:'London'},
{id:4,address:'Miami'}];
And here is input text box with typeahead attribute:
<input type="text" ng-model="selected" typeahead="state.abbreviation as state.name for state in states | filter:$viewValue | limitTo:8">
But the problem that when item is selected the id of the value displayed and not the address.
Here is the planker.
I want the address to be displayed in text box and id value to save in selected
variable.How fix the prblem?