Search code examples
adobeaemsightly

Sightly: check for empty lists


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


Solution

  • Use data-sly-test and ! operator:

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