Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Add an index to #each loop
/**
* Add an index to each loop
*/
UI.registerHelper('indexedArray', function(context, options) {
if (context) {
return context.map(function(item, index) {
item._index = index + 1;
return item;
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment