2 ms·
I just tweaked the GP's example to used <input value="{{name}} ({{age}})"></input>, which rendered as expected. The field wasn't bound to the age or name proper
by v13inc 13y ago
I just tweaked the GP's example to used <input value="{{name}} ({{age}})"></input>, which rendered as expected. The field wasn't bound to the age or name properties though, which makes sense.
In practice, this almost seems like "sugar" that automatically binds an input to a value if it's value contains ONLY the property.
To test out the binding sugar, I tried using this input: <input value=" {{name}}"></input> (note the space before {{name}}), which did not bind {{name}} to the input.
I'm still of the opinion that the binding should be more explicit.
Edit: typo fix
- scottjmiles 13y agoThis is good feedback. We wanted to start with an easy mode, so people could on ramp quickly. In this case, you just use {{ }} for various kinds of binding and Polymer will (try to) do the right thing. I suspect we will need an alternative syntax for folks like yourself that want an explicit, engineering mode.
- v13inc 13y agoIf anyone is interested, I hacked together a proof-of-concept framework with a different take on the {{ }} style binding: https://news.ycombinator.com/item?id=5741708 https://news.ycombinator.com/item?id=5741708