
ptK wrote...

ptK wrote...
Sample.js "use strict";use( function () {var data = {}; data.item = [];data.item.push( {"message": "Message111","anotherArray": [{"ID": "1","val": "1111"}]} );-
return data;});
Sightly File.html <p data-sly-use.sample="create-case-form-validations.js"></p> ${sample. item.message} returns nothing ${sample. item } returns message , anotherArray
How can I read the “ID” value of the JS array [anotherArray] using Sightly.
;
Sightly File.html <p data-sly-use.sample="create-case-form-validations.js"></p> ${sample. item.message} returns nothing ${sample. item } returns message , anotherArray
How can I read the “ID” value of the JS array [anotherArray] using Sightly.
Well for your case you have to modify this a bit.
in java script change
"use strict"; use( function () { var data = {}; data.item = []; data.item.push( { "message": "Message111", "anotherArray": [{ "ID": "1", "val": "1111" }] } ); return data.item[0].anotherArray[0][this.val]; });and while calling from your HTML.
use
<p data-sly-use.sample="${'create-case-form-validations.js' @ val='ID'}">${sample} </p>