I don't know what wrong happens is with my Application. Wherever I have written the javascript code to get Application event, it always returns undefined. And my code is just simple as written below.

var appEvent = $A.get('e.c:EventName');
appEvent.fire(); // Here I got appEvent undefined

  • Will you please share more info? Perhaps the event that you created, the registerEvent snippet etc. – Mohit Arora Nov 16 '17 at 10:22

Did you register your event in your component?

<aura:registerEvent name="unused" type="c:EventName"/>

As documented here.

It also states:

Use $A.get("e.myNamespace:myAppEvent") in JavaScript to get an instance of the myAppEvent event in the myNamespace namespace.

so you need to replace c with your namespace.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.