Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Sling Annotation

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Level 10

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

View solution in original post

8 Replies

Avatar

Level 10

YOu cannot mix @Model and @Component.

Avatar

Level 4

You can inject services directly inside the Model

Avatar

Level 2

Could you please provide me the code snippet.

Avatar

Correct answer by
Level 10

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