Firing an application event

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.248.162