How to do empty check like we used to do in Aura bundle
<aura:if isTrue="{!not(empty(v.opportunityList))}">
I have a datatable in the lwc and want do display a message when no data to display Here my code: HTML:
<template>
<template if:true={parameters.data}>
<!--lightning datatable-->
<lightning-datatable
key-field="id"
data={parameters.data}
onrowaction={handleRowAction}
row-number-offset={rowOffset}
hide-checkbox-column="true"
columns={columns}></lightning-datatable>
</template>
<template if:false={parameters.data}>
No existing Contacts to display
</template>
</template>
JS:
import { LightningElement, wire, track, api } from 'lwc';
//import method from the Apex Class
import fetchMatchingContact from '@salesforce/apex/DisplayContact.fetchMatchingContact';
// Declaring the columns in the datatable
const columns = [
{
label: 'Name',
fieldName: 'Name'
},
{
label: 'Phone',
fieldName: 'Phone'
},
{
label: 'Email',
fieldName: 'Email'
}
];
export default class DisplayExistingContact extends LightningElement {
@api recordId;
@track columns = columns;
@track record = {};
@track data = {};
@track parameters;
@wire(fetchMatchingContact, {leadId: '$recordId'})
parameters;
}