I want to use the index of the parent list (foos) as an argument to a function call in the child list (foos.bars).(我想使用父列表的索引(foos)作为子列表(foos.bars)中函数调用的参数。)
I found a post where someone recommends using $parent.$index, but $index
is not a property of $parent
.(我找到了一个帖子,有人建议使用$ parent。$ index,但$index
不是$parent
的属性。)
How can I access the index of the parent ng-repeat
?(如何访问父ng-repeat
的索引?)
<div ng-repeat="f in foos">
<div>
<div ng-repeat="b in foos.bars">
<a ng-click="addSomething($parent.$index)">Add Something</a>
</div>
</div>
</div>
ask by Coder1 translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…