Sign in to Community
Sign in to view all badges
I need to loop according to given Integer input.
Eg - According to user input, i need to repeat to print some HTML elements.
if user input is 1,
<div> 1 <div>
if user input is 2
<div> 2 <div>
How can i achieve this from HTL.
HTL does not support traditional looping, arithmetic operations.
you have to create a list from user input inside the sling Model as suggested by
Create an Integer List in the Sling Model based on the user input value. Fetch the list in HTL and loop over it.
You can use sly-list or sly-repeat base on requirement.