Quantcast
Channel: Component events vs Application events (component.getEvent vs $A.get) - Salesforce Stack Exchange
Viewing all articles
Browse latest Browse all 4

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

$
0
0

I am new to lightning experience and components. I have been through some blogs and code that guide through the basics, but other than that I haven't had much hands-on experience.

My question is:

When to use component events vs application events? If I have nested components (parent & child) and if the events are of type Component, will the parent be able to handle events fired from child, and vice versa?

Also, I've noticed there are two ways to get an instance of an event (say TestEvent) -

    component.getEvent("TestEvent");

and

    $A.get("e.c:TestEvent");

Is there any difference between the both? What do "$A"& "e" in the second form, represent?

Thanks in advance for your reply!


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images