This is the continuation of Angular Tutorial Series below is the link for youtube series.
https://www.youtube.com/channel/UCpWsImXzkyk9LqD3t3XdoYQ/playlists
Pagination is a very basic function that we need in every application. So let's try to understand how we can apply pagination in our angular app.
To implement pagination we are using PrimeNG DataTable Pagination
Reference Link: https://primefaces.org/primeng/table
What is PAGINATION?
Pagination is a component that displays page informations like page-number | total-records.
To implement pagination we need to manipulate our data and split it into page collection.
Getting Started
First Install the required libraries
Second add the reference in styles
Third register the module in app.module.ts file
Fourth step is to define the datatable. Now open the component.html file and add the ptable
Rows and TotalRecords
Rows, Rows Per Page, Current Page Report Template and other datatable options we need to define how many pages the paginator should display. Paginator below will have 10 rows per page.
Defining the table header
Defining the table body
Defining table footer where we add various options like add new user
Complete Code
Open the component file and add the below mentioned methods for pagination
Run the application using npm start and you are able to see the below mention O/P
![]()
DOWNLOAD THE SOURCE CODE