<ul ng-repeat="nodes in ngModel">
<li ng-repeat="children in nodes">
<a>{{ ul的$index }}.{{ li的$index }}</a>
</li>
</ul>
ngModel
是一个二维数组,请问在<a>
里如何获取<ul>
的$index
呢?得到类似输出0.0、0.1、1.0的效果 ?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
使用
$parent.$index
可以获取到父级的$index
。children in nodes track by $index 这样能取到 自己的index $parent.$index 取到父级的index