Reputation: 36339
In Aurelia, it's pretty simple to create a ul or ol like so:
<ul>
<li repeat.for='item of items'>${item}</li>
</ul>
But what if item
is an object with, let's say a name and description, and I want to do a definition list? The repeat.for
attribute repeats the element it's on, but in the case of a <dl>
I would want to repeat a <dd>
and a <dt>
per iteration on the list. I can't find any relevant syntax to help me with it, or any idea where to begin with it. Is this even possible?
Upvotes: 2
Views: 94
Reputation: 10897
When there isn't a natural single wrapping element, you can just use a template
element to wrap the stuff that needs repeating.
<dl>
<template repeat.for="item of items">
<dd>${item.foo}</dd>
<dt>${item.bar}</dt>
</template>
</dl>
Upvotes: 4