Newer Version Available

This content describes an older version of this product. View Latest

Fire Component Events

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: