DaafVader
DaafVader

Reputation: 1754

Aurelia: Uncaught Error: doSomething is not a function

I am having issues with a VERY basic Aurelia app. On clicking the button, it says it doesn't find doSomething function. Other buttons in other components work fine. Clearly I am doing something fundamentally wrong here?

app.html:

<template>
    <require from="bootstrap/css/bootstrap.css"></require>
    <require from="./styles.css"></require>
    <require from="./client/person-details.html"></require>

    <person-details></person-details>
</template>

person-details.html

<template>
    <button click.delegate="doSomething()">clickey</button>
</template>

person-details.js

export class PersonDetails {
    doSomething() {
        console.log("Doing something");
    }
}

Upvotes: 2

Views: 1274

Answers (1)

Tarps
Tarps

Reputation: 1933

You are currently only importing the HTML of person-details whereas you should import both the JS and HTML portions (usually done automatically by Aurelia, if you leave out the file extension).

<require from="./client/person-details.html"></require>

should be

<require from="./client/person-details"></require>

Upvotes: 7

Related Questions