在一个 ng-repeat 中获取多个 select 的值

Getting values of multiple select inside one ng-repeat

我的 div 之一有一个下拉列表,我从中 select 将下拉列表的数量排在第二 div 中。我的任务是能够 select 第二个 div 中每个下拉菜单的不同值。这是我正在尝试的代码

<div ng-repeat="i in getNumber(secondN2.core.r1r2.value) track by $index">
                <div>
                    <strong><u>For Core link number {{$index+1}}:</u> </strong><br>
                        <strong>Select IM</strong>
                        <select ng-model="im" ng-change="calculate()" >
                            <option value="1 Gig" selected="selected">1 Gig</option>
                            <option value="10 Gig">10 Gig</option>
                        </select><br>

                </div>

</div>

secondN2.core.r1r2.value 是一个数字,我通过在 getNumber 方法

中返回新的 Array(n) 将其转换为数组,一个集合

在这种情况下如何给出正确的 ng-model?以及如何检索值?

如果我尝试给 i.im,它仍然没有帮助。随着im$scope.im即将到来undefined

已更新

什么是两个嵌套循环

<div ng-repeat="j in secondN3.core" style="border:1px solid;">
    <strong>Configure Core Links between {{j.name}}</strong><br><br>
            <div ng-repeat="i in getNumber(j.value) track by $index">
            <div>
                <strong><u>For Core link number {{$index+1}}:</u> </strong><br>
                <strong>Select IM</strong>
                <select ng-model="secondN3.coreValues[[$parent.$index,$index]]" ng-change="calculate()" >
                    <option value="1 Gig" selected="selected">1 Gig</option>
                    <option value="10 Gig">10 Gig</option>
                </select><br>
            </div>
        </div>
<div>

编辑:2

这是有效的:This 是那个

您可以在控制器中使用一个数组来保存选定的值:

$scope.values = [];

然后将您的下拉菜单绑定到此模型:

<select ng-model="values[i]" ng-change="calculate()">
    <option value="1 Gig" selected="selected">1 Gig</option>
    <option value="10 Gig">10 Gig</option>
</select>