Expand my Community achievements bar.

Access object initialized in template inside Components

Avatar

Level 2

Hi folks,

I have this below inside my template and now the coreObject has some public properties I need to access inside a component i am creating is this possible? How can it be done in just sightly?

Template snippet:

<div data-sly-use.coreObject="${'com.tgclass.core.servlets.ViewPolicy' @ PNumber=request.requestParameterMap['PNumber'][0].toString, LName=request.requestParameterMap['LName'][0].toString}" data-sly-test="${coreObject}">

Component snippet

<p><b>Country of Residence:  </b> ${coreObject.GetIsoCountry @ context='unsafe'}</p>.

The reason is I need these components inside Experience fragments to make the whole page authorable even with lots of sightly codes in it.

Thanks!

1 Reply

Avatar

Community Advisor

I don't think so if this is possible. What you can do, you can get all the data and save as JSON object.

e.g.

<script>

var coreObject ={

GetIsoCountry:${coreObject.GetIsoCountry @ context='styleToken'},

....

}

</script>

This coreObject variable will be global variable and will be available through out the page scope.



Arun Patidar