我创造了一个聚合物元素,它有一个嵌套的模板。我想访问子模板中父模板的属性。
<dom-module id="gallery-content">
<template>
<template is="dom-bind">
<iron-ajax url="/getData" last-response={{data}} auto></iron-ajax>
<table id="table-stencils">
<tr>
<td>
<p>{{contentType}}</p>
<hr>
</td>
</tr>
<tr>
<td>
<image-block description={{data.description}}
lastmodified={{data.lastModified}}
imagepath="../../images/11.jpg"></image-block>
</td>
<td>
<image-block description={{data.description}}
lastmodified={{data.lastModified}}
imagepath="../../images/12.jpg"></image-block>
</td>
<td>
<image-block description={{data.description}}
lastmodified={{data.lastModified}}
imagepath="../../images/13.jpg"></image-block>
</td>
<td>
<image-block description={{data.description}}
lastmodified={{data.lastModified}}
imagepath="../../images/14.jpg"></image-block>
</td>
</tr>
</table>
</template>
</template>
<script>
Polymer({
is: "gallery-content",
properties:{
contentType: {
type:String,
value:"Others"
}
}
});
</script>
我无法访问父元素的contentType属性。我在这个图库内容元素中使用了另一个polyment()。
发布于 2016-06-23 14:36:50
下面是正在运行的没有普鲁克尔的元素的dom-bind。请注意,我使用了json作为getData服务和image-block的临时元素
https://stackoverflow.com/questions/37993167
复制相似问题