Newer Version Available
Using the Action Type
An Aura.Action is a reference to an action in the
framework. You can pass an Aura.Action around so the
receiving component can execute the action in its client-side controller.
Use $A.enqueueAction() to add client-side or server-side controller actions to the queue of actions to be executed.
This sample uses Aura.Action.
listRow.cmp
1<aura:component extensible="true">
2 ...
3 <aura:attribute name="onclick" type="Aura.Action"/>
4 ...
5 <li onclick="{!v.onclick}">
6 ...
7 </li>
8</aura:component>The onclick attribute has type="Aura.Action".
subListRow.cmp
1<aura:component extends="docsample:listRow">
2 ...
3 <aura:set attribute="onclick" value="{!c.openRecord}"/>
4 ...
5</aura:component>The subListRow component extends the listRow component and sets the value for the onclick attribute in listRow to {!c.openRecord}, which is a reference to an action in the client-side controller for subListRow.cmp. The action is executed when a user clicks the bullet associated with <li onclick="{!v.onclick}"> in listRow.