javascript - angularjs typehead with toArrayFilter -
i using angularjs typehead
auto-complete:
<input class="form-control reason-select" type="text" ng-model="selectedname" typeahead="name.kod name.value name in list | toarray | filter:$viewvalue | limitto:8">
based on typehead example , using toarray
filter beacuse list
object
, not array
ref - notarray. list
-
{ "0": { "kod": 107, "value": "john doe", }, "1": { "kod": 3994, "value": "jane doe", } }
it works fine choose option kod
displayed instead of value
.
thanks help.
typeahead="name.kod name.value name in list"
means "name.kod" shown user "name.value" saved in $viewvalue.
so in case, working perfect need reverse variables if want show value i.e.jane doe save kod i.e.3994 . hope helps
Comments
Post a Comment