aurelia Custom Elements Javascript Only Custom Element


A Custom Element consisting of Javascript only includes the corresponding HTML view within the @inlineView decorator of Aurelia.

The following example takes two bindable paramters, a prename and a surename, and display both within a predefined sentence.

Example: my-element.js

import { bindable, customElement, inlineView } from 'aurelia-framework';

    <b>Hello, \${prename} \${surename}.</b>
export class Greeter {
  @bindable prename;
  @bindable surename;

Using it:

  <require from="./greeter"></require>
  <greeter prename="Michael" surename="Mueller"></greeter>

This will output "Hello, Michael Mueller." in the browser's window.