Hello Everyone,
This is part of dynamicComponent.html component. Calling other component: helloworld by passing the param.
<div data-sly-resource="${ 'sample' @ resourceType='abc/components/helloworld', appendPath='/*', decorationTagName='div',
cssClassName='new section aem-Grid-newComponent',param='testParam'}"
data-sly-test="${(wcmmode.edit || wcmmode.preview) }"></div>
So, in hellowowrld.html, how can I get the param value?
Similarly, how can i pass the param in data-sly-include case?
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
@Mahesh_Gunaje : With data-sly-resource you may not be able to pass any custom param. If this 'testParam' is going to be static or limited values, you can make use of selectors to do this. In your helloworld component, you can create a htl file such as helloworld.testParam.html and call your helloworld as below.
<div data-sly-resource="${ 'helloworld' @ resourceType='abc/components/helloworld', selectors='testParam' }"></div>
Please refer: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/extra-parameters-in-data-s...
thanks.
@Mahesh_Gunaje : With data-sly-resource you may not be able to pass any custom param. If this 'testParam' is going to be static or limited values, you can make use of selectors to do this. In your helloworld component, you can create a htl file such as helloworld.testParam.html and call your helloworld as below.
<div data-sly-resource="${ 'helloworld' @ resourceType='abc/components/helloworld', selectors='testParam' }"></div>
Please refer: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/extra-parameters-in-data-s...
thanks.
@Mahesh_Gunaje Please check HTL specification https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md#229-resource
You can't pass parameters but you can add selectors.
Hi @Mahesh_Gunaje
You can only pass param to java use api but not when including the resources, you need to rethink the design
https://github.com/arunpatidar02/aem63app-repo/blob/master/java/ParamModel.java
Views
Likes
Replies