'How to apply a loop within a tag?
I have this such a list:
//properties.datas
data-hello="sup"
data-world="w00rld"
Can I generate a tag and loop all the data attributes into there? I only understand how to generate multiple HTML tags.
Result:
<div data-hello="sup" data-world="w00rld">
Solution 1:[1]
You can pass a map to data-sly-attribute and it will render all corresponding pairs as attributes: key="value". See https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md#223-attribute
<div data-sly-attribute="${model.datas}">...</div>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Vlad |
