Week 14 | Native Element Binding

polymer 1.0
Tue Dec 06 2016

Every time we bind a property with an attribute Polymer will listen to the [attribute]-changed event. So for example we have the following syntax:

<paper-input value="{{message}}"></paper-input>

Polymer will listen to the “value-changed” event to figure when to update the message property.

However, in our native events this isn’t always the case. For example for the <input> text element whenever we change the text value the “input” event is triggered. We can listen to the correct event in Polymer with the use of the double colon sign.

So this won’t work:

<input value="{{message}}" />

But this will:

<input value="{{message::input}}" />


Full Stack Weekly Newsletter

A free weekly newsletter for full stack web developers!