+ Start a Discussion

Button should be disable until page fully get loaded in lightning component

I have a lightning App, there is lightning button, which is conditonally enable or disable. 
When it should be in disable state and i refresh the page then UNTIL page fully get loaded the button show as enabled, which allow to click on the button to perform next step. How I can avoid this situation 
Navin Selvaraj23Navin Selvaraj23

In Aura Component, declare one attribute like below.
<aura:attribute name="isButtonDisabled" type="Boolean" default="true"/>

Then, have your lightning button like below:
<lightning:button variant="brand"   disabled="{!v.isButtonDisabled}">Disabled Brand</lightning:button>

In default, the button will be disabled. So, you cannot perform the click opeation.
Once the complete data for you is returned, then you can set this variable as true from client side controller or helper like as follows.

Hope it helps you. If it helps, mark it as your best answer, else please comment below with more detail. we can discuss.

Best Regards,
Navin S