问题描述:

Hi this JSFiddle works in Internet Explorer and Firefox but no other browxsers work. The idea of the code is a currency converter that is up to date using the Yahoo Currency API. It doesn't update the $scope on the other browsers the way it is supposed to on Chrome. http://jsfiddle.net/xHmLT/13/

choose a post ({{visible.post}} is visible)

 <select>

<option ng-repeat="shot in shots" ng-click="visible.post = shot.Name" value="{{shot.Name}}">{{shot.Name}}</option>

</select>

<div ng-repeat="shot in shots" ng-if="visible.post == shot.Name">{{shot.Rate | currency:'':''}}

</div>

<div ng-repeat="shot in shots" ng-if="visible.post == shot.Name">{{shot.Rate *5 | currency:'':''}}

</div>

网友答案:

I updated your fiddle and is working as you'd intended...

Your select is now populated via ng-options and the model is visible.post (as an object). As a result anywhere showing visible.post, is now showing visible.post.Name (field on the object)

<select ng-options="s.Name for s in shots" ng-model="visible.post"></select>

The initialization of the selected value is done in the success promise handler:

$scope.visible.post = $scope.shots[0];
相关阅读:
Top