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
Terence VibanTerence Viban 

Application Event Issues : ​Uncaught error in $ : Cannot read property 'setParams' of undefined

Hi there,

having problems get a reference to my application event. I get the error above showing that my application is undefined. According to the docs I get do this:

var lookupEvt = $A.get("e.c:lookup");
            lookupTyp: sender,
            searchOption: searchOption,

my event is called lookup.evt and looks like this:

<aura:event type="APPLICATION">
    <aura:attribute name="lookupTyp" type="String" />
    <aura:attribute name="searchOption" type="String" />
    <aura:attribute name="selectedEmailAddresses" type="String" />

I register my event in another component like this:

<aura:registerEvent name="lookup" type="c:lookup" />

Component events work fine but I need to use application events because a couple of different components should be able to trigger and handle these events.

Any ideas on how to overcome this problem?

I have used component events and they work perfectly well. But I need 
When you say "I register the event in another component" - are you trying to instantiate the event in the controller of a component that doesn't register the event?
Terence VibanTerence Viban
Hi bob,

I registered my event with two components. My understanding is that it doesn't matter since each of these two components will be able to fire the event. 
As of now I am instantiating the event from the Controller of one of the components that have registered to the event; this is when I get the undefined error.

Just to make sure I am not missing anything, I have set up the following small test.


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

COMPONENT ( has following two lines )

<aura:registerEvent name="toggleLookup" type="c:toggleLookup" />
<ui:button label="Test Event" press="{!c.fireToggleLookupEvent}" />

CONTROLLER (has the following fxn)

fireToggleLookupEvent : function(component, event, helper){
        var toggleEvt = $A.get("e.c:toggleLookup");
        console.log("@@@@ fireToggleLookupEvent - toggleEvt : " + toggleEvt);

Just like before toggleEvt is "undefined".

I would at least expect fireToggleLookupEvent to instantiate this event.

What am I missing???


Mohith Kumar ShrivastavaMohith Kumar Shrivastava
How are you testing this ?Can we get full code to help you with ?I think we just need another component that has both the components and you should be fine .Post the code if further problems ?Thanks