Sunday, 2 April 2017

Start on 1 and not 0 in Handlebars, no template

I am looping through items using @each, and I want to start with index 1 and not 0. I have tried something like

var Handlebars = require('handlebars');

Handlebars.registerHelper("inc", function(value, options)
{
    return parseInt(value) + 1;
});

and then



But when I am loading the page, it says

Error: Missing helper: "inc"

What is another way to do it?



via iNTERS22

No comments:

Post a Comment