AEM 6.x: How to pass an HTL variable to clientlib/JS? | Community
Skip to main content
jayv25585659
Level 8
Mar 19, 2018 12:17 AM UTC
Solved

AEM 6.x: How to pass an HTL variable to clientlib/JS?

So I have the following lines which loads my javascript.

    <sly data-sly-use.clientLib="${'/libs/granite/sightly/templates/clientlib.html'}" data-sly-unwrap />

    <sly data-sly-call="${clientLib.js @ categories='myhost.mycustomJS'}" data-sly-unwrap />

I have an HTL variable/property (example: ${properties.myCustomProperty}) that I want to pass to myCustomJS.

Any ideas how it can be done?

I've looked around the net but didn't find anything useful.

Thank you.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
smacdonald2008
smacdonald2008Accepted solution
Level 10
Mar 19, 2018 2:11 PM UTC

TO work with JS and HTL - you use the JS USE API. See this artilce for more details --

Creating a Tab layout component for Adobe Experience Manager

Hope this helps...

2 replies

Ratna_Kumar
Level 10
Mar 19, 2018 3:17 PM UTC

Yes Scott is right.

You need to use JS with HTL i.e., JS USEAPI for that. Please have the look into that article which Scott pointed out.

Thanks,

Ratna.

Translate
smacdonald2008
smacdonald2008Accepted solution
Level 10
Mar 19, 2018 2:11 PM UTC

TO work with JS and HTL - you use the JS USE API. See this artilce for more details --

Creating a Tab layout component for Adobe Experience Manager

Hope this helps...

Translate