I am trying to handle Application event in a listening component but it doesn't work for some reason. Please, help. I can't write in console log "here" in the end


<aura:application extends="force:slds" access="global">

Search Component

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" >
    <aura:registerEvent name="searchEvt" type="c:SearchEvent" />
    <aura:attribute name="inputSearch" type="String"/>
        <lightning:input label="Search for books and writers:" value="{!v.inputSearch}"/>
        onclick="{!c.getInput}" />

Search Component Controller

getInput : function(component, event, helper) {
    helper.fireAppAction(component, event);

Search Component Helper

fireAppAction : function(component, event) {
        var appEvent = $A.get("e.c:SearchEvent");
            "searchQuery": component.get("v.inputSearch")

Result Component

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes"  access="global" controller="SearchCmpController">

    <aura:handler name="showResultList" event="c:SearchEvent" action="{!c.searchData}"/>

   <aura:attribute name="resultWrappers" type="SearchCmpController.BookWriterWrapper[]"/>
    <aura:attribute name="isEmptyResult" type="Boolean" default="true"/>

        <div class="{!v.IsEmptyResult ? 'disp' : 'slds-hide'}">Results</div>
        <div class="{!v.IsEmptyResult ? 'slds-hide' : 'disp'}">No Results</div>


Result Component Controller

searchData : function(component, event, helper) {
        component.set("v.resultWrappers", true);

Event "SearchEvent"

<aura:event type="APPLICATION">
    <aura:attribute name="searchQuery" type="String"/>

1 Answer 1


You will need to remove the name attribute from your Result Component while declaring the handler.

From documentation:

The handler for an application event won’t work if you set the name attribute in <aura:handler>. Use the name attribute only when you’re handling component events.

So on your Result Component, your handler declaration should be written as (notice there’s no name attribute):

<aura:handler event="c:SearchEvent" action="{!c.searchData}"/>
  • Thanks @Jayant :)
    – Salvation
    Dec 29, 2019 at 7:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .