3

I use the following select statement:

<select ng-model="vm.institution" ng-options="c as c.institutionName for c in vm.institutionsOfUser"></select>

In my model, the institution is stored but what I will have is to onyl store the id of the institution selected (and contained in vm.institutionsOfUser-> id)

Is there a possibility to do this?

1

1 Answer 1

1

You just need to change ngOptions a little c.id as c.institutionName for c in vm.institutionsOfUser:

<select ng-model="vm.institution" 
        ng-options="c.id as c.institutionName for c in vm.institutionsOfUser"></select>

This will bind model to institution id instead of entire object.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.