How to reuse one sling model into another in AEM SPA | Community
Skip to main content
Level 6
November 16, 2022
Solved

How to reuse one sling model into another in AEM SPA

  • November 16, 2022
  • 1 reply
  • 1826 views

I have written one Button SlingModel and I wanted to reuse it into another model. In SPA I can't achieve that. 
I tried with 

@1961677
@14766979
private ButtonModel buttonModel;

 

It is returning null. Is this possible?

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 KNan

Hi 

 

use 

@1961677 @Via("resource")

please refer this 

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-inject-a-sling-model-inside-another-sling-model/td-p/418745

 

Thanks 

1 reply

Community Advisor
November 16, 2022

Hi 

 

Please try this  @ inject

 

refer this  : https://stackoverflow.com/questions/39594183/inject-another-sling-model-from-sling-model

 

Thanks

Ronnie09Author
Level 6
November 16, 2022

Tried this and it didn't work

KNanCommunity AdvisorAccepted solution
Community Advisor
November 16, 2022