[英]Polymer: Two Way Binding to a Child Element Inside a Dom-Repeat Template
我對與聚合物中的數組進行數據綁定感到非常困惑,我認為這是一個非常簡單的用例。
我有一個元素,將數組作為屬性,並且我想顯示數組中每個項目的子元素列表。
<dom-module id="parent-element">
<template>
<h1>This is the parent!</h1>
<template is="dom-repeat" items="{{arrayproperty}}" as="item">
<child-element
propertyone="{{item.propertyone}}"
propertytwo="{{item.propertytwo}}">
</child-element>
</template>
</template>
</dom-module>
這段代碼很棒。 創建適當數量的子元素,並將數組中的屬性傳遞到子元素中。 但是,當更改子元素屬性時,這些更改不會傳遞回父元素數組屬性。 如何使用雙向綁定配置此設置,以便父級從子級元素獲取更新?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.