htl pass data between htl | Community
Skip to main content
ebin_Aby
February 26, 2020
Solved

htl pass data between htl

  • February 26, 2020
  • 2 replies
  • 1652 views

Is there any way we can pass a variable from component to another. 

 

tried

<sly data-sly-resource="${resourceType='my/components/embeddedComponent', myParam='myValue'}></sly>

can I read the myParam in embeddedComponent ? 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

Not sure if you can do that. But you can try to pass variable as selectors

 

<article data-sly-resource="${'path/to/resource' @ selectors='selector'}"></article> <article data-sly-resource="${'path/to/resource' @ selectors=['s1', 's2']}"></article>

 

 

2 replies

BrianKasingli
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
February 26, 2020

 

@ebin_aby 

You can try data-sly-template;

 

<template data-sly-template.component="${ @ title, pageLevel}"><h1>${title}: ${pageLevel}</h1></template> <div data-sly-call="${component @ title=properties.jcr:title, pageLevel='5'}"></div> // ouput <h1>Home Page: 5</h1>

 

Adobe's documentation for data-sly-template can be found here: https://docs.adobe.com/content/help/en/experience-manager-htl/using/htl/block-statements.html#template-call

 

 

 

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
February 27, 2020

Not sure if you can do that. But you can try to pass variable as selectors

 

<article data-sly-resource="${'path/to/resource' @ selectors='selector'}"></article> <article data-sly-resource="${'path/to/resource' @ selectors=['s1', 's2']}"></article>

 

 

Arun Patidar