Reputation: 7191
I am nesting ng-repeat in my App.
In that I'm trying to refer to the $index of parent loop
.div(ng-repeat= item in items)
p(ng-repeat= detail in item.details)
a(href='#') // $$ index ?
how do i refer to the $index of the parent loop (ie. $index of item) inside a nested ng-repeat?
(the above code is in jade)
Upvotes: 7
Views: 7909
Reputation: 42186
Use scope' parent' $index
: $parent.$index
. Something like (just guess , i don't know much about Jade):
.div(ng-repeat= item in items)
p(ng-repeat= detail in item.details)
a(ng-href='#/{{$parent.$index}}')
Working example (not Jade): http://jsfiddle.net/Ysxsx/
Upvotes: 11