我正在研究AngularJS的演示,它可以转换两个单元。基本上我有两个单位值的下拉列表,并希望将下拉列表中的选定值相乘。我为我的代码创建了一个jsfiddle,任何人都可以帮我解决它。
拨弄
fiddle HTML:
<div ng-controller="MyCtrl">
<div ng-repeat="address in addresses">
Billing State:
<select
ng-model="address.state"
ng-options="state.lookupCode as state.description for state in lov_state"></select>
<tt>State selected: {{address.state}}</tt>
</div>
</div>
AngularJS:
var myApp = angular.module('myApp', []);
myApp.controller('MyCtrl', function($scope) {
$scope.addresses = [
{'state': 'AL'},
{'state': 'CA'},
{'state': 'FL'}
];
$scope.lov_state = [
{'lookupCode': 'AL', 'description': 'Alabama'},
{'lookupCode': 'FL', 'description': 'Florida'},
{'lookupCode': 'CA', 'description': 'California'},
{'lookupCode': 'DE', 'description': 'Delaware'}
];
});
我的小提琴代码如下: My JSFiddleworking demo