1
votes

I have one array of objects inside this objects I have some list of id's and using this id's I have to render multiple templates using #each loop for handlebars.

Simple this statement will return me the list of containing names of template.

{{#each data in sections1}}
{{data.id}}
{{/each}}

Output :

A B C D E F G H I J K L M N O P Q R S T U V W X

Consider this all A to Z are different template names respectively Now I'm trying to render all these templates using #each loop in handlebar But I don't know the exact syntax.

For example can we do like this way ?

{{#each data in sections1}}
{{render data.id}} //Here I'm getting error Because of it is not exact syntax
{{/each}}
1

1 Answers

1
votes

Maybe you should consider using partials, naming them with the proper name based on data.id value. Then use them like: {{partial data.id}}

DEMO