We help IT Professionals succeed at work.
Get Started

Angularjs, select combo with selected value in ng-repeat

justaphase asked
Last Modified: 2015-03-27
Hello experts,

I have a ng-repeat and inside the repeat i have two comboboxes (select inputs) with the options based on an array each.
the value row.sourcefield is the selected value of the selects...
How do i do this?

The following code is what i have, but it doesn't work... surely ng-model can't have this "row.sourcefield"... but what to do?
<tr ng-repeat="row in fields">
    <td><select ng-model="row.sourcefield" ng-options="sfield.fieldname for sfield in sourcefields" data-placeholder="Choose an option..." class="select-search" tabindex="2"></select></td>
    <td><select ng-model="row.destinationfield" ng-options="dfield.fieldname for dfield in destinationfields" data-placeholder="Choose an option..." class="select-search" tabindex="2"></select></td>

Open in new window

Thx in advanced,
Watch Question
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE