Sling Annotation | Community
Skip to main content
girishk14
May 31, 2018
Solved

Sling Annotation

  • May 31, 2018
  • 8 replies
  • 4479 views

Hi All,

I have an use case to read the jcr property of component A from the page and use that value in my service implementation and display the processed value on page when that component A is used on a page.

Can I use the  @Model(adaptables = { Resource.class}) to get the resource for reading the jcr property in my service implementation (i.e can we use both @Model and @Component in my service implementation)

Is there any other way to implement the above described use cases.

Thanks in advance

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 smacdonald2008

Look at that article i posted - Navin contributed that code!

8 replies

arunpatidar
Community Advisor
Community Advisor
May 31, 2018
smacdonald2008
May 31, 2018

YOu cannot mix @Model and @Component.

smacdonald2008
May 31, 2018
navinkaushal
May 31, 2018

You

navinkaushal
May 31, 2018

You can inject services directly inside the Model

girishk14
girishk14Author
May 31, 2018

Could you please provide me the code snippet.

smacdonald2008
smacdonald2008Accepted solution
May 31, 2018

Look at that article i posted - Navin contributed that code!

girishk14
girishk14Author
May 31, 2018

Thanks all