javascript - Angular select model not setting value -


i have array of strings, account numbers. when record in table clicked provide modal update record , 1 of fields account number. displays , correctly seems loss 2 way binding vm.accountnumber show value model is.

vm.accountnumber has value set when table row being clicked editing. never makes select despite model. suspect im losing 2 way link , creating own variable model.

  <select class="ui search fluid selection dropdown" id="accountsearch" ng-model="vm.accountnumber">           <!--ng-options="account account in vm.accounts.slice(1)">-->           <option ng-repeat="account in vm.accounts | limitto: vm.accounts.length : 1" value="account" ng-selected="account == vm.accountnumber">{{account}}</option>   </select> 

here snippet of accounts array. 0:"-" 1:"0001" 2:"0002" 3:"0003" 4:"0004"

i use ng-options directive instead of ng-repeating option

<select class="ui search fluid selection dropdown"      id="accountsearch" ng-model="vm.accountnumber"     ng-options="account account in vm.accounts"> </select> 

demo plunkr


though i'd point out problem option value attribute,

you should change

value="account" 

to

value="{{account}}" 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -