简体   繁体   中英

Show one element in Angular based on select input

Hi I am trying in my AngularJS code, I am trying to show just the appropriate currency based on which currency is chosen from the select. I simplified my code down to just the barebones of what I accomplished so far. I appreciate the help. Thank you. See below http://jsbin.com/najih/1/edit

UPDATE: I have gotten the code to show one value but now the drop down doesn't update the list see the code. http://jsbin.com/najih/3/edit

UPDATE: Ok so I found that on my fiddle it works in IE and Firefox but not Chrome and Safari. Anyone know a reason why?

First you should use ng-options="rate.Name for rate in shots . Then attach a model on the select:

<select ng-model="rate" ng-options="rate.Name for rate in shots"></select>

Now you have the selected rate available and based on your question, which i dont realy understand from this point, you could create a radio button:

<label>
  <input type="radio" ng-model="radiorate" ng-value="rate"> {{ radiorate.name }}
</label>

But this doesn't make much sense to me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM