I'm learning Polymer 1.0 data-binding but am struggling to understand the very first example in the developer guide:
https://www.polymer-project.org/1.0/docs/devguide/data-binding.html
Here is the extract:
Data binding binds a property or sub-property of a custom element (the host element) to a property or attribute of an element in its local DOM (the child or target element).
A binding is created with a binding annotation in the host element’s local DOM template:
<dom-module id="host-element">
<template>
<child-element name="{{myName}}"></child-element>
</template>
</dom-module>
Am I right in saying that in this example, host-element will have a property named myName and it will bind (2-way) to the "name" property of child-element? Is child-element supposed to be another custom element? I'm not clear on what is supposed to be binding to what and how this intended to be used.
My original pre-conception of data-binding was when binding data from the outside of the custom element (i.e. where the custom element tag is used) to the inside, or vice versa. However this example seems to be purely internally focussed so perhaps I have misunderstood.
Edit:
To further confuse matters, a later example in the same article uses the binding syntax outside of the local DOM (i.e. where custom_element is used), contrary to the explanation in the previous example.
<script>
Polymer({
is: 'custom-element',
properties: {
prop: {
type: String,
notify: true
}
}
});
</script>
...
<!-- changes to "value" propagate downward to "prop" on child -->
<!-- changes to "prop" propagate upward to "value" on host -->
<custom-element prop="{{value}}"></custom-element>