aurelia Custom Elements Creating A Custom Element Using the @customElement Decorator

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!


In most examples, the class naming convention is used to define an Aurelia Custom Element. However, Aurelia also provides a decorator that can be used to decorate a class. The class is again treated as a custom element by Aurelia then.

The value supplied to the decorator becomes the name of the custom HTML element.

Example: my-element.js

import {customElement} from 'aurelia-framework';

export class MyClass {

    <h1>I am a robots custom element</h1>

Using it:

    <require from="./my-element"></require>


Got any aurelia Question?