How do I pass a loop index into a helper?


#1

I have a helper which returns a

or based on the loop index for each. However I am not able to figure out how to send the index in. In an array the array index comes as @index (as per handlebars docs). I tried the following already

{{tagOpen index=@index}} - this case index is coming as undefined

{{tagOpen @index}} - in this case the page doens’t even load with error saying “Uncaught SyntaxError: Unexpected token ,”

Can some one please help me?


#2

@ is the syntax error. Try without it.


#3

Sorry, I should have mentioned. I tried that as well. Still it came as undefined. I checked forums on handlebars and there it seems to work, so it is strange that I am not able to get it to work.