Passing data to an embedded component via data-sly-resource
I am following the documentation and other posts (stackoverflow, etc.) to find a way to pass parameters to an embeded component. My goal is to create the embedded component that can receive and make use of this data; I also have control over the wrapper component.
In the wrapper component I am embedding using this syntax:
<sly data-sly-resource="${'embeddedComponent' @ resourceType='my/components/embeddedComponent', myParam='myValue'}"></sly>
On the server, I have a Java Use class:
public class MyHelper extends WCMUse {private String myParam = "myDefaultValue";@Override public void activate() throws Exception {this.myParam = get("myParam", String.class); }public String getMyParam() {return myParam; } }
And in my embedded Sightly template, I get the parameter like this:
<sly data-sly-use.helper="com.my.project.helper.MyHelper"><input type="hidden" value="${helper.myParam}" /></sly>
I have done some debugging and discovered that myParam is not in the set of Bindings[] sent to the MyHelper class, and for this reason is not available to the embedded template.
Can anyone help by enlightening me about the correct way to pass information to the embedded component's Sightly template?