Marko Taht
Marko Taht

Reputation: 1536

Aurelia non html-only custom element notrendering

I have a simple custom elemen, but it is not rendering.

If i do <require from="./myfooter.html"></require> then it renders only the html part. But if i do <require from="./myfooter"></require> then nothing is rendered.

What am i doing wrong?

    @inject(ConfigService)
export class MyFooterCustomElement{
    private version: string;
    constructor(
        private configService: ConfigService) {
        this.getVersion()
    }



<template>
    <footer class="footer fixed-bottom d-flex justify-content-between">
        <span class="p-2 ml-40">text</span>
        <span class="text-muted d-flex p-2">v${version}</span>
    </footer>
</template>
    async getVersion() {
        this.version = await this.configService.getVersion();
    }
}

Upvotes: 1

Views: 47

Answers (1)

avrahamcool
avrahamcool

Reputation: 14094

aurelia default rendering is based on naming convention.

rename the class from MyFooterCustomElement to MyFooter

also: when using TS you can write @autoinject() instead of @inject(ConfigService).

Upvotes: 1

Related Questions