gpt4 book ai didi

javascript - Angular ,限制子重复

转载 作者:行者123 更新时间:2023-12-02 16:33:51 34 4
gpt4 key购买 nike

我试图通过其父重复的索引来限制子重复。因此,无论其上的级别索引如何,都将仅限于该值(+ 1,因此我们不会从 0 开始)。这是我的想法 -

        <div class="inputRepeater" ng-repeat="face in inputFaces" ng-show="face.isCurrent" >
<div class="trialGrid">
<table class="table table-striped">
<thead>
<tr>
<th ng-repeat="(key, val) in rowCollection[0]">{{key}}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in rowCollection | limitTo: face.$index + 1">
<td ng-repeat="item in row">{{item}}</td>
</tr>
</tbody>
</table>
</div>
</div>

因此表内的 tr 将仅限于面的初始重复,购买面 $index + 1。这是行不通的。任何见解将不胜感激。谢谢!

最佳答案

您可以使用ng-init保存对上部$index的引用

    <div class="inputRepeater" ng-repeat="face in inputFaces" ng-show="face.isCurrent" >
<div class="trialGrid" ng-init="$faceIndex = $index">
<table class="table table-striped">
<thead>
<tr>
<th ng-repeat="(key, val) in rowCollection[0]">{{key}}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="row in rowCollection | limitTo: $faceIndex + 1">
<td ng-repeat="item in row">{{item}}</td>
</tr>
</tbody>
</table>
</div>
</div>

关于javascript - Angular ,限制子重复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28095896/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com