Builder provides number of helpful properties on it’s state for each block in a repeat, so if you’re doing a repeat on a state.results , you’ll get under it , $resultsItem , and $resultsIndex and those will be available for any repeat under that.
I created a fiddle that loops through an array of arrays, to inspect the object you can see it in the data tag > edit content JS + CSS (scroll till the end)
If you want to see how’s the repeats happening, please go through the layers in the layers tab, and you’ll see a repeat icon, that you can click and see what is being repeated for that layer.
Hi, I’m trying to do something similar but I have already extracted the json data into state.listingsArray as follows:
[{
address: “125 Main St”,
price: 1200000
}, {
address: “7620 197th Street SE”,
price: 1225000
}, {
address: “9603 Avenue M”,
price: 899999
}, {
address: “904 Chestnut Street”,
price: 129900
}]
But my question is how do I do a repeat over this to display a list of the addresses (as text fields)?
I tried doing “Repeat for each state.listingsArray” but I can’t display each address without an index…
Hi @asriram, to access the index within a repeated element, you can use state.$index. However, you should be able to bind the address to text within a repeating element without this.