Hello,
for the Sling Sitebuilder I would like to pass an id that is specified
as an element attribute to the Sightly server side JavaScript file
defined by the JS Use-API. Is that possible?
This example works:
<sly class="component" data-component-type="bs-p" data-component-id="4"
data-sly-use.componentResource="${'component.js' @id='4'}">
...
</sly>
component.js:
"use strict";
use(function () {
return resource.getChild(this.id);
});
content:
{
"jcr:primaryType":"sling:Folder",
"4":{
"jcr:primaryType":"nt:unstructured",
"value":"foo bar"
}
}
But in the 'use' block of the 'sly' tag I specify the '4' as literal
(@id='4'). Instead I would like to reference it e.g. like
@id=attributes.data-component-id. Is that possible?
Thanks in advance for any help!
Best,
Sandro