I love using the PrimeNg library and am currently working with the Table
component that has paginator functionality enabled. In my Django backend application, I am utilizing the PageNumberPagination
. Now, the challenge I am facing is how to retrieve 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();
}
}