Last active
January 27, 2020 19:18
-
-
Save aramvr/de18d7269b946d8d469d9aecf96d21bf to your computer and use it in GitHub Desktop.
Web Components sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let template = document.getElementById("error-message-template"); | |
// template is any HTML based content. Elements, styles, etc. | |
class ErrorMessage extends HTMLElement { | |
constructor() { | |
super(); | |
this.attachShadow({ mode: "open" }); | |
this.shadowRoot.appendChild(template.content); | |
} | |
} | |
window.customElements.define('error-message', ErrorMessage); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment