How to pass parameters to Sling Modal from Sightly Component | Community
Skip to main content
New Participant
June 8, 2017
Solved

How to pass parameters to Sling Modal from Sightly Component

  • June 8, 2017
  • 16 replies
  • 29772 views

Hi ,

I am trying to pass some custom parameters from my Sightly Component to Sling Model. But I am not able to read those passed parameters inside my Sling Model.

Below is my sightly code :

<sly data-sly-use.mySlingModal="${'com.adobe.website.models.ImageModel' @ colour='red', path=resource.path}"></sly>

How to read color and path in side my sling model java class.

Can you please help me in solving this.

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 Eakambaram

Thank you all for responding. We  have solved it as below.

@Model({adaptables=Resource.class, adaptables=SlingHttpServletRequest.class)

So that at the same time I will get my resource/Node/Content properties and the values passed to my sling modal from my sightly component.

16 replies

EakambaramAuthorAccepted solution
New Participant
June 21, 2017

Thank you all for responding. We  have solved it as below.

@Model({adaptables=Resource.class, adaptables=SlingHttpServletRequest.class)

So that at the same time I will get my resource/Node/Content properties and the values passed to my sling modal from my sightly component.

smacdonald2008
New Participant
June 9, 2017

We show use of HTL and Sling Models in this article -- Developing your first Experience Manager 6.3 Components

VeenaVikraman
New Participant
June 8, 2017

Hi Eakambaram

     I hope you have read this blog HTL introduction part 4   . Feike Visser​ has put across the details here. Please check the Sling Model Section and check if this is what you are looking for

Thanks

Veena

Feike_Visser1
Employee
June 8, 2017

What do you mean? @ inject should be available..

New Participant
June 8, 2017

I tried to use @Inject. But I am not able to use @Inject as I am using a different version. Apart form  @Inject do we have any other annotation for reading the parameters passed?

Feike_Visser1
Employee
June 8, 2017

Have your slingmodel be adaptable from slinghttpservlet request.

Then add two properties (colour , path), with the @inject annotation.