Kevin Vincent
Kevin Vincent

Reputation: 617

Angularjs change ng-model value with conditions on binding value

I am facing an issue with ng-model in angularjS. I have this piece of code :

<select ng-model="node[col.field]">
    <option selected="selected">-</option>
    <option>I</option>
    <option>W</option>
    <option>E</option>
</select>

For example, When the user selects "I", I'd like to have node[col.field] = "1" and not node[col.field] = "I". Is that possible to do that ?

Upvotes: 0

Views: 49

Answers (1)

David Villacis C.
David Villacis C.

Reputation: 101

Have you tried using the value attribute of option. I feel you can declare what really every option should mean and then you might be able of using your method.

http://www.w3schools.com/tags/att_option_value.asp

Upvotes: 1

Related Questions