May 9, 2020
Estimated Post Reading Time ~

How to assign a variable with Sightly/HTL

To assign a variable with Sightly you have to use data-sly-test and not data-sly-use as below:

<sly data-sly-test.yourvariable="${yourvalue}"></sly>

Then you can call your variable value as below:
<textarea rows="4" cols="50" name="name">{"Myvariable":${yourvariable}</textarea>
You can also use your variable in a test:
<sly data-sly-test="${yourvalue==true}">displaysomething</sly>


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.