Newer Version Available

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

aura:waiting

Indicates that the app or component is waiting for a response to a server request. This event is fired before aura:doneWaiting.
This event is automatically fired when a server-side action is added using $A.enqueueAction() and subsequently run, or when it’s expecting a response from an Apex controller. The aura:waiting event is handled by a client-side controller. A component can have only one <aura:handler event="aura:waiting"> tag to handle this event.
1<aura:handler event="aura:waiting" action="{!c.showSpinner}"/>
This example shows a spinner when aura:waiting is fired.
1<aura:component>
2     <aura:handler event="aura:waiting" action="{!c.showSpinner}"/>
3    <!-- Other component markup here -->
4    <center><ui:spinner aura:id="spinner"/></center>
5</aura:component>
This client-side controller fires an event that displays the spinner.
1({
2    showSpinner : function (component, event, helper) {
3        var spinner = component.find('spinner');
4        var evt = spinner.get("e.toggle");
5        evt.setParams({ isVisible : true });
6        evt.fire();    
7    }
8})
The aura:waiting handler contains these required attributes.
Attribute Name Type Description
event String The name of the event, which must be set to aura:waiting.
action Object The client-side controller action that handles the event.