Indicates that the app 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> tag to handle this event.
<aura:handler event="aura:waiting" action="{!c.showSpinner}"/>
This
example shows a spinner when
aura:waiting is
fired.
<aura:component>
<aura:handler event="aura:waiting" action="{!c.showSpinner}"/>
<!-- Other component markup here -->
<center><ui:spinner aura:id="spinner"/></center>
</aura:component>
This
client-side controller fires an event that displays the
spinner.
({
showSpinner : function (component, event, helper) {
var spinner = component.find('spinner');
var evt = spinner.get("e.toggle");
evt.setParams({ isVisible : true });
evt.fire();
}
})
The
aura:waiting handler contains these required
attributes.
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. |