Hello,
I'm trying to pass the value from cq:dialog property to a JavaScript function but the compiler is erroring out on the '$'. If I wrap the property in quotes, it's treated like a string. How can I get around this? Using AEM 6.4
<div><sly data-sly-use.logic="${'clientlibs/js/logic.js' @ width=${properties.width}, height=${properties.height}, seperator=','}">
${logic.getFrame}</sly>
</div>
Same thing with a script tag; when written out to the Publisher the value is null
<script>
myFunction(${properties.name}) {
// whatever
});
</script>
Solved! Go to Solution.
Views
Replies
Total Likes
Try below code :
var name = '${properties.name @ context="scriptString"}';
<script>
myFunction(name) {
// whatever
});
</script>
<div><sly data-sly-use.logic="${'clientlibs/js/logic.js' @ width=properties.width, height=properties.height, seperator=','}">
${logic.getFrame}</sly>
</div>
Views
Replies
Total Likes
Try below code :
var name = '${properties.name @ context="scriptString"}';
<script>
myFunction(name) {
// whatever
});
</script>
<div><sly data-sly-use.logic="${'clientlibs/js/logic.js' @ width=properties.width, height=properties.height, seperator=','}">
${logic.getFrame}</sly>
</div>
Views
Replies
Total Likes