ariellea4070516
14-12-2018
Is there a way to test if listChildren will return anything? Something along the line of: <sly data-sly-test=${item.listChildren.size > 0} />
smacdonald2008
Good question - here is more explanation on test -- htl-spec/SPECIFICATION.md at master · adobe/htl-spec · GitHub
See Section -- 2.2.5. Test
Arun_Patidar
MVP
15-12-2018
you can use resource.hasChildren
HTL Global Objects
Resource (Apache Sling 8 API)
Feike_Visser1
Employee
16-12-2018
You can call any method that has no arguments in data-sly-test.
In your case check if your item has these methods.
17-12-2018
Thank you all! Your answers pointed me to a solution. I was able to test whether or not the item had children this way:
<sly data-sly-test=${item.listChildren.hasNext} />