How can I reference the $ index of the parent loop inside a nested ng repeat?

I am using ng-repeat in my application.

In this, I am trying to access the $ index of the parent loop

.div(ng-repeat= item in items) p(ng-repeat= detail in item.details) a(href='#') // $$ index ? 

how can I reference the $ index of the parent loop (i.e. the $ index of the element) inside the ng-repeat nested?

(the above code is in jade)

+7
angularjs angularjs-ng-repeat pug
source share
1 answer

Use parent area $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/

+11
source share

All Articles