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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -