|
Hi, is it possible to render components inside an Handlebars each-loop? For a better understanding I have made this simple example. The code outputs the names correctly (for example 3 times), but the nested component is only rendered once. componentX.js let _data = {
people: [
"John Kate",
"Alan Johnson",
"Charles Hilton"
]
};componentX.html {{#each people}}
Name: {{this}} -
<x-component src="partials/card" data-name="{{this}}"></x-component>
{{/each}}partials/card.html Hello World!Expected output: Real output: Output Raw: Name: John Kate -
<x-component src="partials/card" data-title="John Kate" data-x-component="partials/card" id="spaCompContainer_partialscard_1" rel="spaComponentContainer_partialscard" data-rendered-component="partials_card">Hello World!</x-component>
Name: Alan Johnson -
<x-component src="partials/card" data-title="Alan Johnson" data-x-component="partials/card" id="spaCompContainer_partialscard_2" rel="spaComponentContainer_partialscard"></x-component>
Name: Charles Hilton -
<x-component src="partials/card" data-title="Charles Hilton" data-x-component="partials/card" id="spaCompContainer_partialscard_3" rel="spaComponentContainer_partialscard"></x-component>Thanks for your suggestions. |
Answered by
sucom
Dec 13, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @stnbndr, checkout the following solution...