It looks like there is a typo in your code. In your ContactList.cmp component, you have specified the event name as c:SearchKeyEvent, but in your ContactListController.js controller, you have used c:SearchKeyChange as the event name.
To fix the error, you need to update the event name in ContactList.cmp to c:SearchKeyChange to match the event name used in ContactListController.js.Here's the updated ContactList.cmp component code:
<aura:component controller="ContactController">
<aura:attribute name="contacts" type="Contact[]"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:handler event="c:SearchKeyChange" action="{!c.searchKeyChange}"/>
<ul class="list-group">
<aura:iteration items="{!v.contacts}" var="contact">
<li class="list-group-item">
<a href="{! '⌗contact/' + contact.Id }">
<p>{!contact.Name}</p>
<p>{!contact.Phone}</p>
</a>
</li>
</aura:iteration>
</ul>
</aura:component>
2 risposte