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

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -