1

Lets say that on a page there are multiple custom components. Some of them bear a parent-child relationship, while some are placed directly on the page. So how should I use the spinner component? Do I need to have the markup of spinner component on every component?

I feel there should be only one spinner component, and that all the components should be able to call it in its controller. Might be inheritance concepts can be used.Please suggest, or if possible provide the code to implement the same.

Also how can I display a spinner component when the page loads for the first time?

As per Lightning developer guide, they recommend using the legacy aura:waiting, aura:doneWaiting, and aura:doneRendering application events.

0

on page load you can use render event https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_render_handler.htm. We also have multiple Components . So we have decided that those components which are doing Api calls will have a seprate Spinner.

0

We have singled out our Apex Calls into a service component.

It can be put inside another component or be used via Events. In the latter case it lives as an invisible component on e.g. a Lightning Page.

One of the attributes of this service component controls whether we display a spinner or not.

By that we follow best practices and ensure that we have full control over spinner behaviour.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.