polymerpolymer-1.0

What is the exact difference between Polymer "reflectToAttribute" and "notify"?


The Polymer properties object supports two different keys that I don't quite understand the difference between, reflectToAttribute and notify.

reflectToAttribute says that the attribute on the host node will change when the value changes.

notify says it makes the property available for two-way binding.

Aren't these sort of the same thing? If you have notify set to true, then is there any reason that you would still need reflectToAttribute?

Could someone explain to me exactly how these keys relate to one another? Thanks!


Solution

  • reflectToAttribute is to get the attribute added to the DOM. This way you can for example use it as selector in CSS

    notify is as mentioned in your question for two-way binding.

    These are two entirely different purposes.