Polymer 1 nested dom-if within dom-repeat not updating when data changes

会有一股神秘感。 提交于 2019-12-19 08:13:44

问题


How do you make dom-if templates within dom-repeat's update when the data changes??

Example here http://jsbin.com/xatala/edit?html,output

In the example the data changes after 1.5 seconds but the dom-if's inside the template aren't re-evaluated/rendered. You can see this in the console.log. The data has changed but the view isn't updated.

How would you make this work and what is the reasoning behind it?!


回答1:


Here is example that works: http://jsbin.com/nejadibuju/edit?html,console,output

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

What you were missing is:

Explicit bindings to array items by index isn’t supported

Some explanations are added in the Bin. Related links:

Polymer, binding to array items not working

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



来源:https://stackoverflow.com/questions/34262747/polymer-1-nested-dom-if-within-dom-repeat-not-updating-when-data-changes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!