Component events vs Application events (component.getEvent vs $A.get)

Component events: to talk to a parent using the capture and bubbling mechanism, like with DOM events. Usually, one component is interested by the event, like an event aggregator.

Application events: to broadcast to other components and not exclusively ancestors. Applications events can talk to many components that can be interested by the event. The broadcast can be boxed to an area of the DOM (everything below a DIV for example).

About $A.getEvt() & cmp.getEvent():

Events have been seriously revamped, and the distinction between Component and Application events has been reduced. However, this rework has not yet been translated into an updated API.

I need to remove references to the $A.getEvt() and cmp.getEvent() API because we are still working on a new version of the API. My apologies for the confusion.

About value providers:

Lightning has various value providers: "v" for attributes, "c" for controller, and "e" for events.

Application Event API:

Those are obtained from the global (hence $A.get()) event value provider:

var evt = $A.get("e.myNamespace:myEvent");

Component Event API:

Component must reference events by name, much like an aura:id, and retrieve them from its component (hence cmp.get()) value provider:

var evt = cmp.get("e.myEvent");

You would then declare myEvent on the component as:

<aura:registerEvent name="myEvent" type="namespace:eventName"/>

Why dow have this API? Declaring events on a component allows other components to call controller methods. You had to declare a handler:

<aura:handler name="myEvent" action="{!c.myEventHandler}"/>

That allowed you to call myEventHandler from another component and respect the interface:


Component Events follow Event Bubbling Mechanism .

Lets understand with an example component from salesforce docs

    <c:eventBubblingGrandchild />

In the above example lets say eventBubblingGrandchild component fired an event ,the event then bubbles up and can be handled by a component in the containment hierarchy that receives the bubbled event.

The syntax to handle this is


A containment hierarchy in this case is not c:eventBubblingChild instead it is c:eventBubblingParent .The event is not handled by c:eventBubblingChild as c:eventBubblingChild is in the markup for c:eventBubblingParent but it's not a facet value provider as it's not the outermost component in that markup.

Application events can be handled by any component and does not depend on hierarchy .

The syntax to handle for this is


Now to answer your question on parent to child as you can see you cannot use component events to fire from parent and handle in child while vise versa is true but the event bubbles only to the top containment .