• Padma Sree 39
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Hi, 

I am getting the below exception.

This page has an error. You might just need to refresh it. Unable to find action 'doInit' on the controller of c:contactRecordDispaly Failing descriptor: {c:contactRecordDispaly}

<aura:component controller="contactRecordData" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" >
    <aura:attribute name="conts" type="Contact[]" />    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <table>
        <th>
            <div title="Name">Contact Name</div>
        </th>
        <th>
            <div title="Id">Contact Id</div>
        </th>
        <th>
            <div title="Phone">Phone</div>
        </th>
        <th>
            <div title="Email">Email</div>
        </th>
        <aura:iteration items="{!v.conts}" var="cnt" >
            <tr>
               <div>{!cnt.name}</div>
                <div>{!cnt.Id} </div>
                <div>{!cnt.Phone}</div>
                <div>{!cnt.Email}</div>
            </tr>
        </aura:iteration>
    </table>
</aura:component>

public class contactRecordData {
    @AuraEnabled
    public List<Contact> getContactList(){        
        List<Contact> conList=[select id,FirstName,LastName,Email,Phone    from Contact];
    return conList;
    }

}

({
    doInit : function(component, event, helper) {
        var action = component.get("c.getContactList");
        action.setCallback(this, function(response)
        {
            var state=response.getState()
        if(state==="SUCCESS")
        {
            var Results=response.getReturnValue();
            component.set("v.conts",Results);
        }
                           });
         $A.enqueueAction(action);
    }
        
    
})