function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
akshay desai 9akshay desai 9 

How to call apex method in LWC html

    public static String getContactPhone(){
            return lstAcc[0].Customer_Care_Phone__c;
          }else if(String.isNotBlank(lstAcc[0].Customer_Care_Phone_FZ__c)){
            return lstAcc[0].Customer_Care_Phone_FZ__c;
I wanted to call this return string in LWC
ANUTEJANUTEJ (Salesforce Developers) 
Hi Akshay,

You can try using the below snippet in the js controller of the lwc component to call the apex method.
import { LightningElement, wire } from 'lwc';
import getAccountList from '@salesforce/apex/ContactHelper.getContactPhone';
export default class ContactListLWC extends LightningElement {
    @wire(getContactPhone) contacts;

You won't be able to call the apex method from the HTML file of the LWC component instead you need to make a call from the controller.

For more details, you can try checking this link:

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

akshay desai 9akshay desai 9
Yes i understand that my confusion is
my apex controller method is returning a string 
i want show that string in LWc
ANUTEJANUTEJ (Salesforce Developers) 
Can you try the below part in the template once:

As mentioned in the link - the attribute with wire annotation has two parts and it has two parts data and error and you can try checking this template once.
    <lightning-card title="Ultimate Parent MRR" icon-name="standard:account">
        <div class="slds-m-around_medium">