jquery template plugin - how to access item index for ?
When passing array data to tmpl(), the template plugin will apply the template to each item in the array.
However, I cannot find a way to get at the current item's index, eg as ${$index}
Nor can I find a way to use {{each}} on a top-level item.
My workaround has been to embed my array data in an object, just so I can use {{each}}, just so I can get at the index, but that seems needlessly convoluted. Am I missing something?
I would prefer a consistent design, where {{each}} was used for iteration in any level.