+ Start a Discussion
Shweta Hegde 5Shweta Hegde 5 

Cannot read property 'setParam' of undefined

I am new to lightning components. Following is my code. When I run my code I am getting the Error
"Action failed: c:SearchBar$controller$SearchKeyChange [Cannot read property 'setParam' of undefined] Failing descriptor: {c:SearchBar$controller$SearchKeyChange}"

Please help me to resolve the issue.

// This is my Application

         <div >
                <a href="#" >Lightning Contacts</a>
         <div >

//This is component

<aura:component >
    <input type="text" placeholder="Search" onkeyup="{!c.SearchKeyChange}"/>

//This is controller
    SearchKeyChange : function(component,event, helper) {
        var myEvent=$A.get("e.c:SearcKeyChange");

//This is Event

<aura:event type="APPLICATION" description="Event template" >
    <aura:attribute name="SearchKey" type="String"/>

//This is another component

<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}"/>
        <aura:iteration items="{!v.contacts}" var="contact">
                <a href="{!'#contact/'+contact.Id}">
Nayana KNayana K
<aura:component >
<aura:registerEvent name="searchKeyEvt" type="c:SearchKeyChange"/>
    <input type="text" placeholder="Search" onkeyup="{!c.SearchKeyChange}"/>

missing event register statement