I want to access the index of the outermost ng-repeat.
<div ng-repeat="">
<div ng-repeat="">
<div ng-repeat="">
//I want to get the $index of outer ng-repeat here
</div>
</div>
</div>
I want to access the index of the outermost ng-repeat.
<div ng-repeat="">
<div ng-repeat="">
<div ng-repeat="">
//I want to get the $index of outer ng-repeat here
</div>
</div>
</div>
A nice clean way to do this is with ng-init
So, for example I added a click function and passed it inside the inner most repeat, and in the controller you would see it passed here like :
Can use it however you like, this is just an example.
Use
ng-init
to set the outer index:Then you can use
outerIndex
in the other scopes.Angular documentation has this example specifically