Sangeetha.V
Sangeetha.V

Reputation: 115

Using ng-repeat how to show default selected value using angularjs

Using ng-repeat how to show default selected value using angularjs

my code : I have currencies :

"currencies":["AWG","BAM","BBD","BDT","BGN","BHD"]

selected currency is "BBD"

In my HTML

<select ng-init='toCurrencyCode = currency.toCurrencyCode' ng-model= 'toCurrencyCode' ng-options="toCurrencyCode as code for code in currencies">

</select>

If I wrote like this means last value as selected by default. I need exact selected currency. Please update your idea. Thanks in advance.

Upvotes: 1

Views: 117

Answers (1)

sylwester
sylwester

Reputation: 16498

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

 <select ng-init='toCurrencyCode = currency.toCurrencyCode' ng-model= 'toCurrencyCode' 
 ng-options="code for code in currencies">

Upvotes: 3

Related Questions