Fire a component event to communicate data to another component. A component event can be handled by the component that fired the event or by a component in the containment hierarchy that receives the event.
Register an Event
A component registers that it may fire an event by using <aura:registerEvent> in its markup. For example:
We’ll see how the value of the name attribute is used for firing and handling events.
Fire an Event
To get a reference to a component event in JavaScript, use cmp.getEvent("evtName") where evtName matches the name attribute in <aura:registerEvent>.
Use fire() to fire the event from an instance of a component. For example, in an action function in a client-side controller:
1var compEvent = cmp.getEvent("sampleComponentEvent");2// Optional: set some data for the event (also known as event shape)3// A parameter’s name must match the name attribute4// of one of the event’s <aura:attribute> tags5// compEvent.setParams({"myParam" : myValue });6compEvent.fire();