How do I call methods on other elements?

41 views
Skip to first unread message

Gary Ryan

unread,
Mar 5, 2014, 1:41:11 AM3/5/14
to polym...@googlegroups.com
<link rel="import" href="../bower_components/polymer/polymer.html">
<polymer-element name="my-thing">
   
<script>
       
Polymer('my-thing', {
            athing
: 'hello'
       
});
   
</script>
</polymer-element>

<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="./mything.html">


<polymer-element name="my-hello"">
   
<template>
         
<my-thing id="mything"></my-thing>
   
</template>
   
<script>
       
Polymer('my-hello', {
            ready
: function () {
               
this.mything.athing // returns undefined
           
}
       
});
   
</script>
</polymer-element>


Scott Miles

unread,
Mar 5, 2014, 2:12:21 AM3/5/14
to Gary Ryan, polymer-dev
Nodes with id's are reflected in the `$` hash, not in `this`, so

   this.$.mything.athing; // returns `hello`


Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/7a539b51-7d6e-4e67-a917-343ab4ec2f94%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages