I have this dom-repeat template and I wonder how to pass an Array into attribute.
<dom-module id="my-element">
<template>
<template is="dom-repeat" items="{{headers}}">
<span>{{item}}</span>
</template>
</template>
</dom-module>
<script>
Polymer({
is: "my-element",
properties: {
headers: Array
}
});
</script>
and then in an index.html
file, I bind it like this:
<my-element headers="['abc', 'def']"></my-element>
I tried doing that but I nothing happened and I got the warning Polymer::Attributes: couldn't decode Array as JSON
Switch the double and single quotes. Polymer 1.0 requires correct JSON quotes, in 0.5 the reverse was accepted (source).
<my-element headers='["abc", "def"]'></my-element>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With