I have a button component with property "link" and called by parent component via "data-sly-resource".
Is there a way to append a string (or a query parameters) to the link inside of button component via HTL? (or is there a recommended solution for that without JS?)
Thanks!
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @LyonMartin
Yes, You can pass it via selectors while including the resource as shown below in your parent component:
<div class="heading"
data-sly-resource="${ './headingItem' @ resourceType='weretail/components/heading-item', selectors=['underline','style_h1'] }"></div>
and in your heading-item component either Use JS or sling model, you can retrieve the selectors using below and write your business logic
request.getRequestPathInfo().getSelectors())
@LyonMartin For passing the parameter from sightly to the sling model
<a class="title-text" data-sly-use.linkResolve="${'com.sourcedcode.core.utils.use.LinkResolve' @ href='/content/sourcedcode/home'}" href="${linkResolve.href}" target="${linkResolve.target}" rel="noopener"> ${linkResolve.href} </a>
And in the Sling model
@Model(adaptables = SlingHttpServletRequest.class) public class LinkResolve { @RequestAttribute private String href; public String getHref() { return href; } @PostConstruct public void init() { } }
Hi @LyonMartin
Yes, You can pass it via selectors while including the resource as shown below in your parent component:
<div class="heading"
data-sly-resource="${ './headingItem' @ resourceType='weretail/components/heading-item', selectors=['underline','style_h1'] }"></div>
and in your heading-item component either Use JS or sling model, you can retrieve the selectors using below and write your business logic
request.getRequestPathInfo().getSelectors())
Hi,
You can try this
https://github.com/arunpatidar02/aem63app-repo/blob/master/java/ParamModel.java
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies