I have a conditional lightning spinner, that I am showing when the SAVE Button is clicked. In the end I am setting the spinner variable to false, but the spinner is still loading infinitely. In the javascript file, it is setting to false in the end of the SAVE Method. Below is my code :
LWC :
<template>
<template if:true={showSpinner}>
<div class="loadingSpinner">
<lightning-spinner alternative-text="Loading" size="medium" class="slds-is-fixed"></lightning-spinner>
</div>
</lightning-button>
</template>
<lightning-button variant="brand" label="Save" title="Save" class="slds-m-left_x-small" onclick={submitDetails}>
</template>
Javascript :
showSpinner=false;
submitDetails(event) {
this.showSpinner = true;
console.log('Spinner 1 ::' + this.showSpinner) //set to true
//Operation for SAVE method called
this.showSpinner = false;
console.log('Spinner 2 ::' + this.showSpinner); //set to false
}