How do I call the functions of another element contained within the template (ShadowDOM)?

The question is simple (I hope so). Is there a way to call myFunctA my-elementA function from my-elementB? Or any solution that works similar to how public functions work in Java or C?

<polymer-element name="my-elementA">  
 <template>  
 ...  
 </template>

 <script>
 Polymer({

   myFunctA : function()
   {
   ...
   }

 });
</script>
</polymer-element>

<polymer-element name="my-elementB">  
 <template>
   <my-elementA></my-elementA>  
   ...  
 </template>

 <script>
 Polymer({

   myFunctB : function()
   {
   //call myFunctA()
   }

 });
</script>
</polymer-element>

      

+3


source to share


1 answer


<polymer-element name="my-elementB">  
 <template>
   <my-elementA id="element"></my-elementA>  
   ...  
 </template>

 <script>
  Polymer({

   myFunctB : function()
   {
     this.$.element.myFunctA();
   }

  });
</script>
</polymer-element>

      



+8


source







All Articles