3

The question is simple (I hope so). Is there a way to call the function myFunctA of my-elementA from my-elementB? Or any solution that works similarly 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>
Filburt
  • 17,626
  • 12
  • 64
  • 115
Dave
  • 33
  • 1
  • 3

1 Answers1

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

 <script>
  Polymer({

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

  });
</script>
</polymer-element>
jimi dough10
  • 2,016
  • 2
  • 13
  • 20
  • Thanks a lot! This should really be included in the polymer tutorial where it mentions public functions and attributes but only describes how to access attributes. – Dave Dec 03 '14 at 13:55