July 2018
Beginner to intermediate
458 pages
9h 58m
English
You can fire an event from the controller or helper file by using the following code snippet:
var appEvent = $A.get("e.c:appEvent");// Optional: set some data for the event (also known as event shape)// A parameter's name must match the name attribute// of one of the event's <aura:attribute> tags//appEvent.setParam({ "message" : myValue });appEvent.fire();
Notice that we have used a global $A variable, and we obtain the instance of the application event using the type of the application. Also, use setParam (for only one parameter) or setParams() (for multiple parameters) to provide the ability to set the event attributes.
Read now
Unlock full access