Hi Team
I have a sling model which I am using in htl file but I few values are not getting printed.
<sly data-sly-use.helper="${'com.****.aem.****.helpers.SampleModel'}"/>
<p> address is ${helper.deliveryAddress.firstName} </p>
My deliverAddress() method is having some address details like firstName, line1, line2, street
I am able to print firstName and line1 but not line2 and street.
There is another sling model which is able to retrieve all firstName, line1, line2, street which I used that sling model in my htl file it is printing however printing in some other htl file.
Kindly help me if I am doing any mistake.
Also let me know how to take value from sling model to js so that I can see what deliveryAddress() is printing.
Thanks and Regards
Prashanthi
Solved! Go to Solution.
Views
Replies
Total Likes
Most likely you are missing the proper context, If the value contains some special character HTL will avoid printing the values for security reasons, that's why you should always use the proper context.
Try something like this:
<p> address is ${helper.deliveryAddress.firstName @ context='html'} </p>
Please read more about context here: https://github.com/adobe/htl-spec/blob/1.4/SPECIFICATION.md#121-display-context
Hi @Prashardan
Try adding a debugger in your code. Check what values are flowing into the code before you fetch them into your HTL.
Start your AEM local instance in Debug mode.
Follow this document to check how to debug AEM : https://aemgeeks.com/aem-debugging/how-to-start-aem-in-debug-mode/
Check if the line2 values is coming into your Sling Model.
Also if your use the debugger you would not have to get the value in JS to see it.
You can also try printing helper.deliveryAddress to see what exactly is coming from Sling model.
Thanks
We need to look at your sling model and the HTL file to guide you better with your issue. Please post your sling model and htl file if you can.
Most likely you are missing the proper context, If the value contains some special character HTL will avoid printing the values for security reasons, that's why you should always use the proper context.
Try something like this:
<p> address is ${helper.deliveryAddress.firstName @ context='html'} </p>
Please read more about context here: https://github.com/adobe/htl-spec/blob/1.4/SPECIFICATION.md#121-display-context
Views
Likes
Replies