<tr>
<td>{{transDept}}</td>
<td ng-repeat="x in Sales">
<select ng-model="ddl[transDept.AccountCode]" onchange="changeSelectedOptionText(this)" style="width:100px;">
<option value=""> </option>
<option ng-selected="trans.AccountCode == {{x}}.{{transDept}}" ng-repeat="trans in CatogoriesAccountdatas" value="{{trans.AccountCode}}">{{trans.AccountCode}}| {{trans.Name}} </option>
</select>
</td>
</tr>
{ “行动”: “PostConfigurationData.accountsetting”, “ConfigurationFilter”:{ “CompanyID”:0, “用户名”:空, “密码”:NULL, “用户ID”:0} “ConfigurationData”:“[ {\ “CompanyID \”: “+ COMPANYID +”,\ “ENTITYID \”: “+ $ scope.LOGINENTITYID +”,\ “系\”:\ “BENDIGO \”,\ “帐户\”:\ “{\\”材质\\ “:200,\\” 劳动\\ “:090,\\” 一般\\ “:445,\\” 运费\\ “:970,\\” 费\\ “:300,\\”四舍五入\\ “:970} \”}]“},
答案 0 :(得分:1)
你可以这样,跟踪每行中数组中的选定元素。你可以根据你的要求进一步提高这一点,但我希望这对你来说是个很好的解决点。
var app = angular.module("sampleApp", []);
app.controller("sampleController", ["$scope",
function($scope) {
$scope.dataSelected = [];
$scope.dropdownValuesCollection = [{
name: "One",
data: [{
name: 'Name',
value: '123'
}, {
name: 'Name-1',
value: '123-1'
}, {
name: 'Name-2',
value: '123-2'
}]
}, {
name: "Two",
data: [{
name: 'Name',
value: '123'
}, {
name: 'Name-1',
value: '123-1'
}, {
name: 'Name-2',
value: '123-2'
}]
}, ];
}
]);
&#13;
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular.min.js"></script>
<div ng-app="sampleApp">
<div ng-controller="sampleController">
<table>
<tr ng-repeat="dropdownValues in dropdownValuesCollection track by $index" ng-init="dataSelected[$index].company = dropdownValues.name">
<td>
{{dropdownValues.name}}
</td>
<td>
<select ng-model="dataSelected[$index].dropdownValue">
<option ng-repeat="item in dropdownValues.data" ng-value="dropdownValues.name +'-'+ item.value">{{dropdownValues.name +"-"+ item.name}}</option>
</select>
</td>
</tr>
</table>
Selected Values : {{dataSelected}}
</div>
</div>
&#13;