Clear: check for empty lists

Using data-sly-list I can iterate over the list object in Sightly, but how can I check if the list is empty? data-sly-list just doesn't display anything in empty list objects, and I need to display alternate text if there are no items in the list.

thanks

+5
source share
1 answer

Use the data-sly-test operator and ! :

 <div data-sly-test="${!myList}">List is empty</div> 
+13
source

Source: https://habr.com/ru/post/1210645/


All Articles