I have a list of object of type say <ABC>
which I am accessing in my HTML file as :
Solved! Go to Solution.
Views
Replies
Total Likes
You can send Json Array( as a String) of Breadcrumb List from the Sling Models to data-myList attribute in HTML.
You can use GSON for POJO to JSON conversion or you can write logic to create JsonArray containing data of breadcrumb as a JsonObject. Then in your getter method, you can send the jsonArray.toString() so that return type is String and understood by JS.
https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/google/gson/JsonO...
http://www.javased.com/?api=com.google.gson.JsonObject
You can refer data-cmp-data-layer attribute of Core components which is created for similar purpose.
Views
Replies
Total Likes
You can send Json Array( as a String) of Breadcrumb List from the Sling Models to data-myList attribute in HTML.
You can use GSON for POJO to JSON conversion or you can write logic to create JsonArray containing data of breadcrumb as a JsonObject. Then in your getter method, you can send the jsonArray.toString() so that return type is String and understood by JS.
https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/google/gson/JsonO...
http://www.javased.com/?api=com.google.gson.JsonObject
You can refer data-cmp-data-layer attribute of Core components which is created for similar purpose.
Views
Replies
Total Likes
yes currently doing it via JSON only , is there any better approach to do it ?
There are other ways as well like using AJAX but this approach is good to go. Analytics integration is also following same design.
https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/data-lay...
Views
Replies
Total Likes
okay thank you
Views
Likes
Replies