Skip to content

Instantly share code, notes, and snippets.

Embed
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;
});
}
});
@yankeyhotel

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.