You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{#Component}}
Part Head
{{else}}
Part Content
{{/Component}}
So it's fine even if it's look "hacky" to use else block to provide two contentBlock.
In case I built something with more than two I can not use this trick.
I wish to be able to define multiple contentBlock in template and to call be able to specific which content for which contentBlock.
Example usage :
{{#Component}}
<templateBlock1>
Part Head
</templateBlock1>
<templateBlock2>
Part Content
</templateBlock2>
{{/Component}}
and for the definion:
```hbs
<templatename="Component> <div class="head">{{>Template.contentBlock1}} </div> <div class="content">{{>Template.contentBlock2}} </div></template>
It should be like extending the Template.elseBlock to allow more than one.
The goal is to be able to build more flexible template.
The text was updated successfully, but these errors were encountered:
The elseBlock is actually just undocumented but it's 100% supported. However, I agree that there could be a better solution for multiple content blocks.
Currently we can pass arguments to the contentblock, so we could structure them using something like a reserved ìd` attribute:
we could use this attribute to inject a view, say contentBlock, that could be used within the parent:
{{#component}}{{#this.contentBlockid="foo"}}
bar
{{/this.contentBlock}}{{#this.contentBlockid="bar"}}
moo
{{/this.contentBlock}}{{/component}}
Alternatively instead of using ids we could also see if it's feasible to simply use index-based order but that would require to always call all this.contentBlock while the id based solution would allow to skip certain blocks, if desired, which would be the most flexible soltion IMO.
Hi,
I have the following usecase :
So now I can call the
template
like this:So it's fine even if it's look "hacky" to use
else
block to provide twocontentBlock
.In case I built something with more than two I can not use this trick.
I wish to be able to define multiple
contentBlock
in template and to call be able to specific which content for whichcontentBlock
.Example usage :
It should be like extending the
Template.elseBlock
to allow more than one.The goal is to be able to build more flexible template.
The text was updated successfully, but these errors were encountered: