0

Can someone tell me how I can write the following pug code in handlebars code?

ul
      for product in products
          li #{product.product}
          li #{product.price}

I found the following code, but I have to populate two points per iteration. So I don't know how to implement that.

handlebars.registerHelper('list', function(n, block) {
    var accum = '';
    for(n in block)
        accum1 += block.fn(n);
    return accum;
});

Thanks.

Zarif
  • 587
  • 1
  • 4
  • 26

1 Answers1

2

Try this

<ul>
{{#each products}}
   <li>{{product}}</li>
   <li>{{price}}</li>
{{/each}}
</ul>
strah
  • 6,702
  • 4
  • 33
  • 45