Answers for "call a method imperatively in lwc"

0

call a method imperatively in lwc

import { LightningElement,wire,track } from 'lwc';
import getAllActiveAccounts from '@salesforce/apex/AccountController.getAllActiveAccounts';
export default class WireMethodDemo extends LightningElement {

    @track accountsList;
    @track showAccounts;
    
    onShowClick(){

        getAllActiveAccounts()
        .then(result => {
                this.accountsList = result;
                this.showAccounts = true;
        })
        .catch(error => {
            console.log('Error Occured:- '+error.body.message);
        });
    }
    onHideClick(){
        this.showAccounts = false;
    }
}
Posted by: Guest on January-11-2021

Browse Popular Code Answers by Language