sdanigo
Posts: 0
Joined: Sat Jun 06, 2015 8:50 pm

how to get the i value of an iteration ?

Hi,
certainly a stupid question but, how to get the 'i' of an iteration when we map an array on a screen?
I mean, I want to know on wich iteration we are.
Can someone provide a JS code for that ?

Thanks

Sylvain

sdanigo
Posts: 0
Joined: Sat Jun 06, 2015 8:50 pm

how to get the i value of an iteration ?

Found an answer
for those who are interested, here is my solution (may be not the best but working):

var indexElement=element[0].attributes._idx.nodeValue;
indexElement=indexElement.substring(1);
console.log(parseInt(indexElement,10));

in the mapping, where you put your 'i' collection

Return to “Issues”