<div class="btn-container">
<button *ngIf="!isLoading">Enter</button>
<button *ngIf="isLoading"><span class="circle"></span></button>
</div>
.btn-container {
button{
background-color: red;
color: white;
max-width: 300px;
width: 100%;
border: none;
outline: none;
font-style: normal;
font-size: 18px;
list-style: 22px;
padding: 13px 15px;
border-radius: 30px;
text-transform: uppercase;
box-sizing: border-box;
margin-top: 20px;
display: flex;
justify-content: center;
align-items: center;
}
}
.circle {
width: 20px;
height: 20px;
display: block;
border-radius: 50%;
border: 2px solid rgb(255 255 255 / 0.5);
border-top-color: white;
animation: rotate 1s linear infinite;
}
@keyframes rotate {
100% {
rotate: 360deg;
}
}
another code
<div class="action btn-container">
<button *ngIf="isLoading" type="button" mat-raised-button color="primary" (click)="onUploadImages()">
Upload Now
</button>
<button *ngIf="!isLoading" class="loading-button"><span class="circle"></span></button>
</div>
isLoading: boolean = true;
private addImagesToGallery(data: Gallery[]) {
this.isLoading = false;
this.galleryService.insertManyGallery(data)
.subscribe(res => {
if(res?.success){
this.isLoading = true;
this.reloadService.needRefreshData$();
this.dialogRef.close();
} else {
this.isLoading = false;
}
}, error => {
console.log(error);
});
}
Top comments (0)