171
rated 0 times
[
174]
[
3]
/ answers: 1 / hits: 18669
/ 7 Years ago, sat, february 18, 2017, 12:00:00
I'm developing for sending an Array as element's attribute.
File form-list.html
<dom-module id=form-list>
<template>
<div>{{title}} - {{owner}} </div>
<form>
<template is=dom-repeat items={{inputAndLabel}}>
<div><label>{{item.tag}} {{owner}}</label><input type={{item.type}} value={{item.defaultValue}}></div>
</template>
</form>
</template>
<script>
Polymer({
is: 'form-list',
properties: {
owner: {
value:Mechanical,
},
inputAndLabel: {
type: Array,
value: function() { return []; }
}
},
ready: function() {
this.title = 'Formulario: Usuario';
}
});
</script>
</dom-module>
So, for using the element and pass the inputAndLabel propertie (it's an Array) that is not work, but the owner property works (it's a string).
<form-list inputAndLabel=[
{defaultValue: '', type:'text', tag: 'Nombre' },
{defaultValue: '', type:'text', tag: 'Apellido' },
{defaultValue: '', type:'text', tag: 'Email' },
{defaultValue: '', type:'text', tag: 'Dirección' }] owner=Eternal>
</form-list>
How to send an array as custom element's property?
Thanks
More From » polymer