user13151042
user13151042

Reputation: 35

How to make ng-options to choose a specific value from the dropdown list?

I have a ng-model called field.value which is also from ng-repeat. when I check the field.value by putting inside the <span> element. I can check the value is 17 from which I expected the drop down goes to the id of 17 but it's doing nothing. How can I make the dropdown choose a value depending on id bound with model.

<div ng-if="field.name=='OrderTypeId'" class="input-group inputFill">
    <select class="form-control inputFill2" ng-model="field.value"
     ng-options="oderType.id as oderType.name for oderType in dropdown.availableOrderTypes  | orderBy:'name'  track by oderType.id">
    </select>
    <span>{{field.value}}<span>
</div>

Upvotes: 0

Views: 25

Answers (1)

georgeawg
georgeawg

Reputation: 48948

From the Docs:

select as and track by

Be careful when using select as and track by in the same expression.

For more information, see

Upvotes: 0

Related Questions