javascript - How to pass data from child custom element back to parent element from where it is called in Polymer 2 -


i have custom element in polymer below

 <parent-element>       <child-element mydata="{{data}}"> </child-element>   <!--modifies data-->      <!-- want pass updated data child-element-2-->       <child-element-2> </child-element-2>   </parent-element> 

let me know how pass updated data 2nd child element

data-binding way go here.
should using dash on attribute while in properties camelcase. can read in polymer documentation property name attribute name mapping.

<dom-module id="my-element">   <template>     <my-child-one data="{{data}}"></my-child-one>     <my-child-two add-data="[[data]]"></my-child-two>   </template>   <script>    polymer({      is: 'my-element',         properties: {           data: {           type: string,        },    });   </script> </dom-module> 

also not forget set notify true on property inside my-child-one element.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -