I try to bind custom sub elements to values of local storage by using polymer's
template repeat
functionality like this:
<polymer-element name="aw-outerElement">
<template>
<template repeat="{{group in grouplist}}">
<aw-innerElement groupId="{{group.groupId}}" name="{{group.name}}" val="{{group.val}}"></aw-innerElement>
</template>
</template>
<script>
Polymer('aw-outerElement', {
ready : function () {
// Binding the project to the data-fields
this.prj = au.app.prj;
this.grouplist = [
{ groupId: 100, name: 'GroupName1', val: this.prj.ke.groupVal100},
{ groupId: 200, name: 'GroupName2', val: this.prj.ke.groupVal200}
];
}
</script>
In the code above I try to pass the data binding this.prj.ke.groupVal100
and this.prj.ke.groupVal200
to my inner element aw-innerElement
through the attribute val
. The aw-innerElement
is a custom paper-input
element where the value attribute should be set to e.g. this.prj.ke.groupVal100
. It seems that only the stored initial value 0 will be set and NOT the data-binding string this.prj.ke.groupVal100
inside the value attribute. Is there a way to make a data-binding with template repeat
inside inner elements?
My inner elements looks like this:
<polymer-element name="aw-innerElement" attributes="groupId name val">
<template>
<paper-input type="number" floatingLabel label="{{groupId}} {{name}}" value="{{val}}" error="{{i18nnrerror}}"></paper-input>
</template>
<script>
Polymer('aw-innerElement', {
publish: {
groupId: 0,
name: '',
val: 0
},
ready : function () {
// Binding the project to the data-fields
this.prj = au.app.prj;
...
}
</script>
As you can see above the value="{{val}}"
of my innerElement should be set to this.prj.ke.groupVal100
and this.prj.ke.groupVal200
.
Thanks in advance!