document.querySelector will look for elements in the main document. You
want to look for my-element inside of your element's shadow dom.

Polymer.dom(this.root).querySelector('my-element') or better yet, put an id
on my-element and use node finding.

https://www.polymer-project.org/1.0/docs/devguide/local-dom.html#node-finding

On Tue, Nov 3, 2015 at 10:26 PM Chrispinus Onyancha <
[email protected]> wrote:

> http://plnkr.co/edit/wkFOzB1Dyjd16SaMJV6S?p=preview   Please help me
> understand what could be the issue with this?
>
> I want to call the method add from the parent element.
>
> <dom-module id="my-one">
>   <template>
>     <my-element></my-element>
>   </template>
> </dom-module>
> <script>
>
> Polymer({
>       is: 'my-one',
>       properties: {
>
>       },
>       ready:function(){
>          var element = document.querySelector('my-element');
>          console.log(element.add(2,7));
>
>       }
>     });
>
>
> </script>
>
>
> And the my-element looks like this.
>
>
> <base href="http://element-party.xyz";>
> <script
> src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
> <link rel="import" href="all-elements.html">
>
> <script>
> var cast = window.cast || {};
> (function () {
>     'use strict';
>     var Element = Polymer({
>       is: 'my-element',
>       properties: {
>
>       },
>       add:function(one, two){
>         return one+two;
>       }
>     });
>     Elemet.ValueX ={name: "Chris"};
>     cast.Element = Element;
> })();
>
> </script>
>
>
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/polymer-dev/d731e875-f2f5-4270-b473-05591787c5e4%40googlegroups.com
> <https://groups.google.com/d/msgid/polymer-dev/d731e875-f2f5-4270-b473-05591787c5e4%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/polymer-dev/CACGqRCDYx7cSAS0XnH2ybeh32QNd_BZqnx03qD8GEJq%2B64ydyA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to