its not working
You should run the query in the [\page code and pass it to the custom element with setAttribute.
//Page code:
//...run the query...
text1 = firstItem.x;
text2 = firstItem.y;
$w('#customeElement1').setAttribute('text1', text1);
$w('#customeElement1').setAttribute('text2', text2);
Then keep handling the newValue in the custom element file (in the attributeChangeCallback hook)
attribute pass only string and mumber
not array so iam getting array in this page
If you wish to pass an array or an object. do something like this:
//page code
let array= ['some array'];
$w('#customelement').setAttribute('attribute-name',JSON.stringify(array));
//custom code attribute change hook:
if(name === 'attribute-name'){
const value = JSON.parse(newValue);
//continue from here with the value
}
@jonatandor35 thank you bro
@subasskutti Hi, how did you pass an array into the custom element? Can you please share the code?