anandaravindan
anandaravindan

Reputation: 2551

Polymer Simple Component Not working - Everything is loaded but No Shawdow Root, No Error

I am trying out polymer and could not make it to work a simple component. Based on the docs. I have done the following thing

Added webcomponents.js, imported polymer.html and created a simple helloworld component without any script. I can see everyhting loaded in the DEV tools but the shawdow root is not created in helloworld components.

Polymer version is "polymer": "Polymer/polymer#~1.0.5"

Below is the hello world code.

<polymer-element name="hello-world" noscript>
  <template>
    <h1>Hello World</h1>
  </template>
</polymer-element>

Webcomponentjs with 200

Polymer and helloworld components loaded

But no shawdow root in helloworld.enter image description here

What am I doing wrong here.

Upvotes: 0

Views: 41

Answers (1)

Ben Thomas
Ben Thomas

Reputation: 3200

You are using Polymer v1.0 but you are do not appear to be declaring your element in the way you should be for this version. See here:

<dom-module id="hello-world">
  <style>
    /* CSS rules for your element */
  </style>

  <template>
    <!-- local DOM for your element -->

    <h1>Hello world</h1>
  </template>

  <script>
    // element registration
    Polymer({
      is: "hello-world"
    });
  </script>
</dom-module>

Upvotes: 1

Related Questions