Infinite scroll replaces "load more" buttons.

This commit is contained in:
softsimon
2020-03-01 03:32:12 +07:00
parent 3d575035a1
commit ab9f39884f
11 changed files with 34 additions and 13 deletions

View File

@@ -65,14 +65,13 @@
<br>
<app-transactions-list [transactions]="transactions"></app-transactions-list>
<app-transactions-list [transactions]="transactions" (loadMore)="loadMore()"></app-transactions-list>
<div class="text-center">
<ng-template [ngIf]="isLoadingTransactions">
<div class="spinner-border"></div>
<br><br>
</ng-template>
<button *ngIf="transactions?.length && transactions?.length !== block.tx_count" type="button" class="btn btn-primary" (click)="loadMore()">Load more</button>
</div>
</ng-template>

View File

@@ -96,6 +96,10 @@ export class BlockComponent implements OnInit {
}
loadMore() {
if (this.isLoadingTransactions || !this.transactions.length || this.transactions.length === this.block.tx_count) {
return;
}
this.isLoadingTransactions = true;
this.electrsApiService.getBlockTransactions$(this.block.id, this.transactions.length)
.subscribe((transactions) => {