AEM JavaScript Use-API String Multi JSON
JSON content parsing, e.g.,
jcr:content
Type string[]
with JSON values.
Use-API JavaScript
myProp.js
"use strict"
;
use(function() {
let val = [];
try {
let myPropStrings = properties.get('myProp') || [];
val = myPropStrings.map(function(data){
return JSON.parse(data);
});
} catch (e) {
log.error('Could not read myProp: ' + e.message);
}
return val;
});
HTL Sample
<div data-sly-use.data="myProp.js">
<sly data-sly-list="${data}">
<h3 data-label="${item.label}">
${item.title}
</h3>
<div>${item.desc}</div>
</sly>
</div>
No comments:
Post a Comment
If you have any doubts or questions, please let us know.