Passing a parameter to a component | Community
Skip to main content
October 16, 2015
Solved

Passing a parameter to a component

  • October 16, 2015
  • 2 replies
  • 690 views

I've created a custom template which uses a custom component to insert an image into a dps article.

I want to use this component through a workflow which renders an article for each image in the DAM. I want to make the "img source=" a variable where I can pass the name of each image that it refers to.

I.E: <img src="/content/dam/images/my"+imagevariable>

What options do I have and what would be the best approach here?

Did some reading and came across using Slightly request? I was thinking of putting the name of the image in a property which I can pull out and change for each image within the component.

Thanks,

Ram

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
The best way to make images a variable  is to write and read from JCR node props. So in one part of your AEM app, write the image to a prop. Then read that prop when you need to know what image to display.       

2 replies

smacdonald2008
smacdonald2008Accepted solution
October 16, 2015
The best way to make images a variable  is to write and read from JCR node props. So in one part of your AEM app, write the image to a prop. Then read that prop when you need to know what image to display.       
October 16, 2015

Thanks exactly what I'm doing!

Ram