Polymer 1.0: Data binding variable to <iron-meta> element (value attribute)

我的梦境 提交于 2019-12-24 17:28:25

问题


In Polymer 1.0, I am trying to data bind a string variable {{str}} to an <iron-meta> element (tag in parent element) as follows.

This fails:

<iron-meta id="meta" key="info" value="{{str}}"></iron-meta>

The above code breaks. But the following code works (without the binding).

This works:

<iron-meta id="meta" key="info" value="foo/bar"></iron-meta>

The difference is the variable version {{str}} fails and the constant version "foo/bar" works.

Does anyone have a clue what is what is breaking the binding and how to fix it?

Edits in response to comment questions:

  1. How does it fail? This fails silently. The values I have printed out simply do not update when I press the Login and Register buttons.

  2. Here is a link to the code in a Github repository. See lines


回答1:


You need to use an attribute binding and not a property binding

<input type="text" value$="{{str}}" />


来源:https://stackoverflow.com/questions/31282947/polymer-1-0-data-binding-variable-to-iron-meta-element-value-attribute

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