Sightly - Include another HTML and pass parameters

Avatar

Avatar

ashtrick

Avatar

ashtrick

ashtrick

15-10-2015

Hi smiley

I'm wondering if this is possible?

I have a component (xcomponent) and have the two sightly templates in this as follows

  1. xcomponent.html
  2. y.html

​I'm using JAVA-USE API to get the data for the template and including the y.html in xcomponent.html as below

<div data-sly-use.componentService="XComponentProxy" data-sly-test="${componentService}" data-sly-unwrap=""> <div data-sly-test.componentData="${componentService.componentData}" data-sly-unwrap=""> <!-- Template HTML goes here --> <!-- Template HTML goes here --> <!-- Template HTML goes here --> <div data-sly-include="y.html" data-sly-unwrap="${!(wcmmode.edit || wcmmode.design)}"></div> </div> </div>

Can someone please help me on how to pass the parameters from xcomponent.html to y.html so that I can use componentData created in xcomponent in y.html?

Thanks,

View Entire Topic

Avatar

Avatar

gabriel_walt

Employee

Avatar

gabriel_walt

Employee

gabriel_walt
Employee

15-10-2015

Btw, to keep the template markup as simple as possible, your first two divs should be combined into one:

<div data-sly-use.componentService="XComponentProxy" data-sly-test="${componentService && componentService.componentData}" data-sly-unwrap> ... </div>