vdl-repeat
Create a copy of the element containing the vdl-repeat attribute for each item in a Set, scenario on the shelf, or each element in a plain JavaScript array.
Example
<p>Show the support level for each scenario</p>
<ul vdl-repeat="=s in scenarios">
<li vdl-repeat="=supportLevel in s.entities.SupportLevel" vdl-text="=supportLevel.label"></li>
</ul>
<p>Show a list item for each element of a place JavaScript array. Also show the loop index</p>
<script>
function getItems() {
return ['one', 'two', 'three'];
}
</script>
<ul>
<li vdl-repeat="=item,index in getItems()" vdl-text="=index + ': ' + item"></li>
</ul>
Attributes
vdl-repeat | An expression in the form: "=x,y in expression", where "x" is the value of the current item, "y" is the current loop count and "expression" is a standard JavaScript expression that returns a Set, list of scenario or plain array. The loop variables, "x" and "y", can be referenced anywhere else on or within the element containing the vdl-repeat attribute. | requires expression | required |
---|