I use the PrimeNg library and the Table
component with paginator enabled. The Django backend application uses PageNumberPagination
. How can I get the current page number from this component?
<p-table
[value]="rows"
[paginator]="true"
[rows]="10"
></p-table>
@Component({
selector: 'app-table',
templateUrl: 'table.html',
standalone: true,
imports: [TableModule, CommonModule],
providers: [ApiService]
})
export class TablePaginatorBasicDemo {
rows!: Row[];
constructor(private apiService: ApiService) {}
ngOnInit() {
this.apiService.getRows().pipe(tap((rows) => ({this.rows = rows}))).subscribe();
}
}