Search code examples
javascriptaurelia

custom component/template not showing


After playing around with Aurelia for a while, i'm trying to creating a custom component/template. However with below minimal code i still cant seem to show the message that is in testcomponent.html. I see the <testcomponent></testcomponent> in html DOM, however not the message test. What am i doing wrong?

integrationcomponent.html

<template>
    <require from="./forms/testcomponent"></require>
    <h1>first page</h1>
    <testcomponent></testcomponent>
</template>

testcomponent.js

export class TestComponent {

    constructor() {


    }

}

testcomponent.html

<template>
    <p>test</p>
</template>

Solution

  • The classname is TestComponent; this tells Aurelia to look for test-component.html and test-component.js.

    I think you can rename the class to 'Testcomponent' as well.

    Aurelia is Convention over Configuration so you need to know the conventions.

    Aren't there any error messages in the console?