Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Include one component in other


Level 6

i have a component A.

Now i should create a component B. The requirement is there will be image in Component B. when you click on it ComponentA should pop out

Can some one suggest me efficient way to do it !!!



0 Replies


Level 8

Maybe try something like this

<div class="component-a"> <div class="component-b" data-sly-resource="${'image' @ resourceType='wcm/foundation/components/image'}"> </div> </div> <script type="text/javascript"> (function () { $('.component-a').on('click', function () { //Do something with component-b > img here }); }); </script>


Level 6

Hi leeasling 

Will te dialog,html and styling of component A will be included in component B if I use this code?


Level 10

Do not this as assume permanent include.

Lets says,

You have two separate component A and component B.

Once you include B in A using code shared above. When ever you get component A on page you will see B will be included in it.

But still Component B will be rendered by it's own resource type and Component A will be rendered by it's own resource type.