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.
1swfobject.registerObject("clippy.codeblock-0", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<aura:handler event="aura:waiting" action="{!c.showSpinner}"/>
This example shows a spinner when aura:waiting is fired.
1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<aura:component>
18     <aura:handler event="aura:waiting" action="{!c.showSpinner}"/>
19    <!-- Other component markup here -->
20    <center><ui:spinner aura:id="spinner"/></center>
21</aura:component>
This client-side controller fires an event that displays the spinner.
1swfobject.registerObject("clippy.codeblock-2", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17({
18    showSpinner : function (component, event, helper) {
19        var spinner = component.find('spinner');
20        var evt = spinner.get("e.toggle");
21        evt.setParams({ isVisible : true });
22        evt.fire();    
23    }
24})
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.