0

I wrote the following code and it is working fine in my playground but get this error in passing challenge.

We can't find 'lightning-input' in accountFinder.html.

accountFinder.Html

<template>
<lightning-card>
    <lightning-input
        type="Number"
        formatter= "currency"
        label="Annual Revenue"
        value={annualRevenue}
        onchange={handleChange}>
    </lightning-input>
    <lightning-button
        label="Reset"
        onclick={reset}>
    </lightning-button>
</lightning-card>

accountFinder.js

import { LightningElement } from 'lwc';
export default class AccountSearch extends LightningElement {
    annualRevenue = null;
    handleChange(event) {
        this.annualRevenue = event.detail.value;
    }
    reset() {
        this.annualRevenue = null;
    }
}

accountFinder.js-meta.xml

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>48.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
    </targets>
</LightningComponentBundle>

Trailhead Error in Challenge

I've tried this new 2 new playground but unable to pass the challenge. I think I'm making some silly mistake. can anyone help me to pass this challenge?

Thanks in advance.

2
  • Did you create the LWC Visualforce Devs app page?
    – Klecool
    Jun 29, 2020 at 7:39
  • yes, also set defaultusername=lwc_for_vf_devs Jun 29, 2020 at 7:46

2 Answers 2

0

You need to use number not Number and remove space before "currency".

<template>
    <lightning-card>
        <lightning-input
            type="number"
            formatter="currency"
            label="Annual Revenue"
            value={annualRevenue}
            onchange={handleChange}>
        </lightning-input>
        <lightning-button
            label="Reset"
            onclick={reset}>
        </lightning-button>
    </lightning-card>    
</template>
2
  • Hey Klecool, Thanks for the solution. it works. Trailhead uses 'Number' that's why I was writing the same. Thank you again for help Jun 29, 2020 at 19:36
  • Now they fixed the Issue and it accepts type="Number" to pass this challenge. Dec 23, 2021 at 19:03
0

in accountFinder.js

you need to change export class in : export default class accountFinder // not AccountSearch

1
  • Names for default exports don't matter.
    – ondrakr
    Nov 29, 2023 at 12:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .