#69 {{each}} with tagName
1 min readSep 2, 2016
Guest Tip by Devin Weaver
I just learned that the {{#each}} can take tagName and class attributes!
When before you had to wrap your {{each}}:
<ul class="list-group">
{{#each items as |item|}}
<li class="list-group-item">{{item.label}}</li>
{{/each}}
</ul>
Instead you can do this with:
{{#each items tagName="ul" class="list-group" as |item|}}
<li class="list-group-item">{{item.label}}</li>
{{/each}}
This might prove useful with the tag-less component feature in a previous tip.
Credits & Links
- Guest post by Devin Weaver:
- Website https://tritarget.org/
- sukima on Twitter https://twitter.com/sukima
- sukima on GitHub https://github.com/sukima
- sukima on Keybase https://keybase.io/sukima
Originally published at Ember Daily Tips.