Polymer 1.0 Node.bind() - Can I create a binding via javascript instead of double braces?
Asked Answered
C

1

0

Is there a way in Polymer 1.0 to set up a binding using javascript like Node.bind() did previously?

[Ignore this: Apparently being succinct is not allowed in stackoverflow so I have to write this useless sentence in order to post the question.]

Compton answered 7/7, 2015 at 14:15 Comment(0)
A
2

Short answer is: NO. Polymer 1.0 currently does not support imperative data-binding.

In 1.0, the data-binding mechanism was completely rewrote, so previous 0.5-ish techniques like Node.bind('content', new PathObserver(obj, 'path.to.value')); or

Polymer.import(["/elements/x-test.html"], function () {
  var el = document.createElement('x-test');
  el.setAttribute('foo', '{{bar}}');
  document.querySelector("#insertion_point").appendChild(el);
});

or html-echo does not work.

More info in this SO question: Binding imperatively

More info in Github: https://github.com/Polymer/polymer/issues/1778

Agnes answered 7/7, 2015 at 17:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.