Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sightly: check for empty lists

Tags:

aem

adobe

sightly

Using data-sly-list I can iterate over a list object in Sightly, but how can I check if a list is empty? data-sly-list simply renders nothing on empty list objects and I need to display an alternativ text if the list contains no items.

Thanks

like image 536
Markus Haack Avatar asked Jan 08 '15 08:01

Markus Haack


1 Answers

Use data-sly-test and ! operator:

<div data-sly-test="${!myList}">List is empty</div>
like image 73
Tomek Rękawek Avatar answered Sep 19 '22 12:09

Tomek Rękawek