Handlebars.js: nested {{#each}} doen't work

32 Views Asked by At

Note: I'm using express-handlebars

My test data for render: data: [[1,2], [3,4], [5,6] ];

My .hbs tempalte:

{{#each data}}
  <div>
  {{#each inner}}
    inside - {{this}}
  {{/each}}
  </div>
{{/each}}

Outer #each works just fine, but the inner is acting like there is no data to render.

I've looked into similar questions/examples, all are using the same syntax.

There are no errors and in others ways hb works fine.

1

There are 1 best solutions below

0
Mero On BEST ANSWER

My solution was to use names for #each variables:

<div>
  {{#each data as |nums|}}
    {{#each nums as |num|}}
      <div>! {{num}} </div>
    {{/each}}
  {{/each}}
</div>