聚合物1嵌套dom-如果在dom-repeat内,则在数据更改时不更新

时间:2015-12-14 08:45:56

标签: polymer polymer-1.0

当数据发生变化时,如何在dom-if的更新中制作dom-repeat个模板?

此处示例http://jsbin.com/xatala/edit?html,output

在示例中,数据在1.5秒后发生变化,但模板内的dom-if不会被重新评估/渲染。您可以在console.log中看到这一点。数据已更改,但视图未更新。

你将如何完成这项工作?背后的原因是什么?!

1 个答案:

答案 0 :(得分:4)

以下示例有效:http://jsbin.com/nejadibuju/edit?html,console,output

<template is="dom-if" 
  if="{{arrayItem(myItems.*, index, 'isGood')}}">
      [[item.title]] is SOOO good.
</template>

你缺少的是:

  

Explicit bindings to array items by index isn’t supported

Bin中添加了一些解释。 相关链接:

Polymer, binding to array items not working

http://plnkr.co/edit/aOmw4e?p=preview