在选择框中选择某个项目时,我想使用父div中的其他字段。在这种情况下,国家
我的代码:
的的index.php
<div class="field" id="{{$index+1}}" ng-repeat="t in getTimes(fieldSelect) track by $index")>
<select name="drop_down" class="marketSelect">
<option ng-repeat="item in items">{{item.name}}</option>
</select>
{{item.country}}
</div>
angular.js
$http({
method: 'GET',
url: 'assets/json/currency.json'
}).then(function successCallback(response) {
$scope.items = response.data.currency;
}, function errorCallback(response) {
console.log("Oh shit, JSON is not working");
});
答案 0 :(得分:1)
将ng-model
指令与ng-options
:
<select ng-options="item as item.name for item in items"
ng-model="selectedItem">
</select>
然后在你的div中:
{{ selectedItem.country }}