Polymer with one-way data binding

I tried to find an answer to my questions, but I can't seem to find any information about one way data binding with Polymer.

I searched for Polymer and found many aspects of it very interesting. I am, however, wondering if the polymer can be "used" in a different way. Differs from the way I see it being used in examples and tutorials.

Is it possible to use one-way binding from model to view only (and not to model view) ?. How about no binding at all?

Obviously, you can create additional variables in the model and update the "real parts of the model" in a more controlled way. But maybe there is some kind of backed up alternatives?

Another thing that makes me hesitate with the Polymer train jump is the way of integration between the polymer components. Are there alternatives to using declarative integration / composition. Can the various polymer components be assembled in a more controlled manner (i.e. programmatically).

I am sure this is possible. But can this be done in an elegant way? Has anyone tried this approach?

For example, knockout offers some kind of beforechange event to allow more controls to update observables. But this ugly "work around" makes the whole process cumbersome.

Thanks in advance for your help!

+3


source to share


1 answer


Update

In Polymer 1.x is [[]]

designed for one-way binding.

original

Check out the official Polymer documentation .

Disposable bindings

Sometimes you may not need dynamic bindings. There are one-off bindings for these cases.



Anywhere you use ¸ {{}}

in expressions, you can use double brackets ( [[]]

) to set a one-time binding. The binding becomes inactive after {{site.project_title}} sets its value the first time.

Example:

<input type="text" value="this value is inserted once: [[ obj.value ]]">

      

One-time bindings can potentially be a performance win if you don't need the overhead of setting up property monitoring.

See also https://code.google.com/p/dart/issues/detail?id=21022

+1


source







All Articles