0

I have a select lists with currencies. Its made like this:

<select ng-model="model.currency">
    <option value="USD">Amercian Dollars</option>
    <option value="EUR">Euro</option>
</select>

I need to find a way so that the option text changes when I select an option. I tried an ng-change but I cant find a way to set the option text. Just to clarify:

  1. The value should be the currency code
  2. The selected text shown should be the currency code
  3. If I click on my select the list of options should be the fullname

So whats missing in the scenario above is to set the value as text when selecting it.

bad_coder
  • 11,289
  • 20
  • 44
  • 72
user727507
  • 275
  • 1
  • 2
  • 11

1 Answers1

1

select is a special directive in AngularJS. You need to declare ng-options and set options in controller.

OZ_
  • 12,492
  • 7
  • 50
  • 68
  • yepp, I done that in other places, but still I dont know how to display the value when selected and the text when the select is active (eg. clicked) – user727507 May 06 '14 at 13:35
  • create jsFiddle with issue and I will show you how to solve it. – OZ_ May 06 '14 at 13:36
  • When I select American dollars I want the selected option in the select to say USD. When I select Euro I want the selected option to say EUR (eg. replace American dollars to USD and Euro to EUR when I select it. I only want the full name in the list, but short name to display when selected) – user727507 May 07 '14 at 13:36
  • so do it, what are u waiting for? I'm not your employee, go learn by example and do what u need. – OZ_ May 07 '14 at 14:42