-->

How To Use Nested Each In Handlebars Template

Assalamualaikum wr wb
Hello guys today i will share to you about How to Use Nested each in Handlebars Template. Oke below is the example of code.

You can use ../ to access the parent in a Handlebars template:

{{#each by_width}}
    {{#each by_height}}
       w: {{../this}}
       h: {{this}}
    {{/each}}
{{/each}}

That of course assumes that by_height is inside each element of by_width, if they're both at the top level then you'd need another ../:

{{#each by_width}}
    {{#each ../by_height}}
       w: {{../this}}
       h: {{this}}
    {{/each}}
{{/each}}

Source stackoverflow => https://stackoverflow.com/questions/14059157/handlebars-js-each-loop-inside-another-each-loop-3
Sumber https://rafibanget.blogspot.com/

Baca juga: