Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between {{}} and [[]] in the template data binding in Polymer?

Tags:

polymer

I sometimes come across {{}} syntax and sometimes [[]] in the template data binding. I am rather sure [[]] usage, which is referring the properties in the component,but what does {{}} do?

like image 680
David Avatar asked Sep 07 '16 08:09

David


1 Answers

From https://www.polymer-project.org/1.0/docs/devguide/data-binding

Binding annotation Text surrounded by double curly bracket ({{ }}) or double square bracket ([[ ]]) delimiters. Identifies the host data being bound. Compound binding A string literal containing one or more binding annotations.

Whether data flow goes down from host to target, up from target to host, or both ways is controlled by the type of binding annotation and the configuration of the target property.

  • Double-curly brackets (}) support both upward and downward data flow.

  • Double square brackets ([[ ]]) are one-way, and support only only downward data flow.

like image 144
Günter Zöchbauer Avatar answered Jan 04 '23 01:01

Günter Zöchbauer