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 '20 at 7:39
  • yes, also set defaultusername=lwc_for_vf_devs Jun 29 '20 at 7:46
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>
1
  • 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 '20 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.