Firing the component event

To fire a component event, the syntax is a bit different from an application event, and uses the name identifier to identify the event:

var compEvent = component.getEvent("sampleComponentEvent");// 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// compEvent.setParams({"myParam" : myValue });compEvent.fire();

Get Learning Salesforce Lightning Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.