Strictly Programming

Polymer: Register an element

Posted in Polymer by sqllyw on 08/23/2016

Register an element in Polymer

It’s quite easy to register an element in Polymer, just remember the element name should be separated by a dash, example: this works:”my-element”, this will not work:”myelement”

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <title>register an element</title>
    <!-- import latest release version of all components from polygit -->
    <base href="">
    <script src="webcomponentsjs/webcomponents-lite.js"></script>
    <link href="polymer/polymer.html" rel="import">


<dom-module id="my-elem">
            is: "my-elem",
            ready: function () {
                this.textContent = 'I am my-elem'


try it in jsFiddle

Tagged with:

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: