Nova · Layouts
Nested loops
A loop inside a loop. The inner one reads the outer one's element as well as its own.
{
id: 'nested-loops',
data: {
rows: [
{ name: 'A', seats: [1, 2] },
{ name: 'B', seats: [1, 2, 3] },
],
},
layout: {
component: 'Stack',
children: [
{
for: '$.rows',
as: 'row',
key: 'name',
do: {
for: '$row.seats',
as: 'seat',
do: { component: 'Text', children: '{{$row.name}}{{$seat}}' },
},
},
],
},
}A1
A2
B1
B2
B3
Nothing. It is only drawn.
{
rows: [
{ name: 'A', seats: [1, 2] },
{ name: 'B', seats: [1, 2, 3] },
],
}A1 A2 B1 B2 B3
Left: the action as the package ships it. Right: the same action running in this page, rendered with this site’s components. Below: the action run as the example specifies, on the installed package.