How to check the size of list in sightly?

Avatar

Avatar

Dinu_Arya

Avatar

Dinu_Arya

Dinu_Arya

15-10-2015

[Thread Edited By Adobe]

/*Don’t forget to meet and greet your fellow peers virtually by telling them about yourself here

Go ahead and to it now: https://adobe.ly/3eDnB4v */

 

Actual Post:

Hi,

I need to check size of the list in sightly. I need to display UI only when it has more than 2 items in list. Any idea?

Thanks,

Arya.

View Entire Topic

Avatar

Avatar

hemantbellani-O

Avatar

hemantbellani-O

hemantbellani-O

15-09-2017

Hi Felke.

On trying the snippet as below:

    <div data-sly-test="${myList.size > 5}" data-sly-unwrap>

  Heloo!!!!!

        </div>

We get an error as:

Invalid types in comparison. Comparison is supported for Number types only.

Could you please throw some light on why this could be the case?

Thanks,

Hemant Bellani