Binding arrays Last updated: 05. Dec 2022
This example shows basic binding binding of data to HTML. This way you can generate HTML pages from your Docly documents.
Example
Data
{
"Numbers" : [1, 2, 3],
"Objects" : [
{ "Name" : "test 1"},
{ "Name" : "test 2"},
{ "Name" : "test 3"}
]
}
Code
<b>Numbers:</b>
#for(var number of Numbers) {#
<a>#number#</a>
#}#
<b>Objects:</b>
#for(var obj of Objects) {#
<div>#obj.Name#</div>
#}#
Output
<b>Numbers:</b>
<a>1</a>
<a>2</a>
<a>3</a>
<b>Objects:</b>
<div>test 1</div>
<div>test 2</div>
<div>test 3</div>