Databinding of polymer paper_input does not work

后端 未结 1 827
北海茫月
北海茫月 2021-01-22 18:12

I have the following code where a 2-way binding is expected between first_name and the property val.

  

        
相关标签:
1条回答
  • 2021-01-22 18:13

    EDIT

    An updated Polymer packages was just published that should fix this issue see https://groups.google.com/a/dartlang.org/forum/#!topic/bugs/-2f-TeaOoac for more details.

    You need to adjust your dependency constraint to get this update because its a development release

    polymer: ">= 0.11.1-dev < 0.12.0" 
    

    EDIT END

    There is an open issue for this code.google.com/p/dart/issues/detail?id=19794

    Until it is fixed, you can work around it by adding an on-change event handler:

    <paper-input
        label="First" floatinglabel
        error="Invalid input"
    
        id="first_name"
        value='{{val}}'
        on-change='{{firstNameChangeHandler}}'
        >
      </paper-input>
    
      void firstNameChangeHandler() {
        val = ($['first_name'] as PaperInput).value;
      }
    
    0 讨论(0)
提交回复
热议问题