1

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

Let Me Tink About It
  • 15,156
  • 21
  • 98
  • 207

1 Answers1

2

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

<input type="text" value$="{{str}}" />
epascarello
  • 204,599
  • 20
  • 195
  • 236
  • Both versions of the binding syntax work as expected. Specifically, `value="{{str}}"` AND `value$={{str}}` both work. – Let Me Tink About It Jul 10 '15 at 17:08
  • I am confused by the answer, the code has no input element to bind to? Also if assumed epascarello refers to the iron-selector by his example, it actually has a property 'value' (not attribute value), why should you use value$={{..}} to set it? @Mowzer can you also please further clear what you meant by your comment? – Salah Saleh Sep 06 '15 at 23:24