File size: 953 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
<div>
<h1>Infinite Query with max pages</h1>
<h3>4 projects per page</h3>
<h3>3 pages max</h3>
@if (query.isPending()) {
<p>Loading...</p>
} @else if (query.isError()) {
<span>Error: {{ query.error().message }}</span>
} @else {
<div>
<button
(click)="query.fetchPreviousPage()"
[disabled]="previousButtonDisabled()"
>
{{ previousButtonText() }}
</button>
</div>
@for (page of query.data().pages; track $index) {
@for (project of page.data; track project.id) {
<p [projectStyle]="project.id">{{ project.name }} {{ project.id }}</p>
}
}
<div>
<button (click)="query.fetchNextPage()" [disabled]="nextButtonDisabled()">
{{ nextButtonText() }}
</button>
</div>
<div>
{{
query.isFetching() && !query.isFetchingNextPage()
? 'Background Updating...'
: null
}}
</div>
}
<hr />
</div>
|