0

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

1
  • Will you please share more info? Perhaps the event that you created, the registerEvent snippet etc. Nov 16, 2017 at 10:22

1 Answer 1

1

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.

4

You must log in to answer this question.

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