Can you ask this on stackoverflow with a polymer tag so we can answer
there? I bet other people in the future will be interested in the answer.


On Wed, Mar 5, 2014 at 10:48 AM, <[email protected]> wrote:

> Hi,
>
> I am trying to instantiate web components directly from Javascript but the
> system does not find the public constructor. I'll put a simple example to
> show the context and the results:
>
> HTML Template:
>
> <polymer-element name="wc-foo" constructor="Foo" noscript>
>     <template>
>        Hello World!
>     </template>
> </polymer-element>
>
> HTML index:
>
> <html>
> <head>
>     <script src="general/scripts/polymer/polymer.min.js"></script>
>     <link rel="import" href="...">
> </head>
>
> <body>
> </body>
>
> <script>
>  console.log (window); // (1)
> console.log (window.Foo); // (2)
> var foo = new Foo (); // (3)
> </script>
>
> </html>
>
> Console Results:
>
> (1) I have checked the window object and it includes the constructor Foo: 
> function
> (){return f(a)}
> (2) I don't know what but window.Foo returns undefined
> (3) ...And so, new Foo() fails: Uncaught ReferenceError: Foo is not
> defined
>
> Someone can help me to understand whats is the problem?
> Thanks.
>
> 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/8f1d8146-32d0-4ab6-9642-508abdcf75fb%40googlegroups.com<https://groups.google.com/d/msgid/polymer-dev/8f1d8146-32d0-4ab6-9642-508abdcf75fb%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

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/CAPwaZpXddwS7dWVzpVkHrdT80oYjvZj6Xr-YH6r40iKv2%3D_dKw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to