vintot
vintot

Reputation: 260

How to get the string value only in select tag angular?

http://plnkr.co/edit/SxdjrBeUF48DrdFQuFHz?p=preview

I have a selected and I want to get the value only.

this is what I currently getting

{"_code":"AUD","description":"AUD - Australian Dollar"}

what I want to get

"AUD"

how can I accomplish this, below is my code.

<select ng-model="myModel"
    ng-options="o.description for o in currencies track by o._code">
</select>

Note: I can't ng-repeat my <option> tag instead, because I am trying to edit object and I want it to be selected in the select tag.

Upvotes: 0

Views: 113

Answers (1)

Raghavendra
Raghavendra

Reputation: 5387

ng-options="o._code as o.description for o in currencies"

Plunk: http://plnkr.co/edit/UZy39F4CwX8Ey8WryWVm?p=preview

Upvotes: 1

Related Questions