Passing data between components (embed) | Community
Skip to main content
Level 2
December 2, 2020
Question

Passing data between components (embed)

  • December 2, 2020
  • 1 reply
  • 2345 views

I need an error modal that works across the entire site. It will be triggered on different pages depending on different scenarios. 

 

I wrote a component solely for the modal. Then I embedded the modal in another component. Here is my embed code: 

 

<sly data-sly-resource="${'myPage-modal' @ resourceType= '/apps/store/components/content/modal',
decorationTagName='div', cssClassName='myPage-modal'}" />
 
I then dropped this modal onto the main language page. I configured there. It worked fine when I need to trigger the modal in the main page. However, when I need to trigger the model that has the custom class "myPage-modal", the modal is triggered, but the content of the modal is not there. When I checked the page source, I saw two modals there: one is the component that I dropped there and another one is embed one. The data is populated into the main component but not populated into the embed one. I am not sure how to make it work. Have I missed anything in my setup? Any help would be appreciated!

 

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

1 reply

Manjunath_K
Level 7
December 3, 2020

Hi @lucy.wang,

Have you configured the modal component after adding the component(in which this modal component is included) to the page? please share modal component html 

lucy.wangAuthor
Level 2
December 3, 2020
Hi @manjunathh, thank you for the reply! Yes, I have configured the modal component. Here is the html code of my modal