Two way data binding with Polymer.Templatizer

前端 未结 1 986
说谎
说谎 2021-01-20 09:51

I am trying to get two way data-binding between a host element and a template in Polymer using templatizer. For example if I am trying to keep two input boxes in-sync:

相关标签:
1条回答
  • 2021-01-20 10:01

    It beats my why I can never get neither _forwardParentPath nor _forwardParentProp to run. However, I know when the other two run :)

    _forwardInstanceProp runs for direct properties of model passed to stamp and _instanceProps is initialized:

    this._instanceProps = {
      text: true
    };
    
    var clone = this.stamp({
      text: this.text
    });
    

    _forwardInstancePath on the other hand runs when you pass nested objects to stamp:

    var clone = this.stamp({
      nested: {
        text: this.text
      }
    });
    

    See this bin for an example: http://jsbin.com/kipato/2/edit?html,js,console,output

    In the stamped template there are two inputs bound to two variables which trigger instanceProp and instancePath. Unfortunately I've been unable to fix the error thrown when the latter happens.

    0 讨论(0)
提交回复
热议问题