In view of the directive, I have two ng repeats. This directive creates a table, and the data of each cell in the table is from another data source. This data source needs a cumulative index of two repeaters.
selectedKandidaat.AntwoordenLijst[$index].Value
I only have the current $ index or $ parent. $ index. Therefore, in order to track the general index that I want to use in Antwoordenlijst [ $ index ], I will need to track the index variable. Can I just use the creation and updating of the index variable in the view.
Something like that:
..
{{ totalIndex = 0 }}
<tr ng-repeat="opgave in opgaven">
<td ng-repeat="item in opgave.Items">
{{ totalIndex += 1 }}
..
Actual code
<table class="table">
<tr ng-repeat="opgave in opgaven">
<td ng-repeat="item in opgave.Items">
<select ng-model="selectedKandidaat.AntwoordenLijst[$index].Value"
ng-options="alternatief for alternatief in item.Alternatieven">
</select>
</td>
</tr>
</table>
source
share