Angular 11 Pagination 100,000+ Rows
Introduction
Have you ever come across a web application where it is slow to display a data table? The crawling performance is typical in any application that has a lot of data. The amount of data plays a big role in how fast a table will load. The root cause is “over-fetching” data.
The fix for “over-fetching” is server-side pagination — a programming technique for which only a subset of data such as 10 rows will be provided by the backend for display in the frontend.
Pagination, also known as paging, is the process of dividing a document into discrete pages, either electronic pages or printed pages. — Wikipedia
Are there libraries or tools out there to assist with server-side paging in Angular? In this story, I will employ the open-source project Angular DataTables, together with ASP.NET v5 REST API, to achieve a speedy display of 100,000+ rows of data.
Tutorial Content
To demonstrate how simple it is to do paging in Angular, I will start an application from scratch and then add Angular Datatables to support paging. The tutorial is divided into four parts:
Part 1: Scaffold an Angular 11 app using app generator Ngx-Rocket. By default, the generator will create the Home page and About page. These two pages will be used later on in parts 3 and 4 of the tutorial.
Part 2: Install the Angular Datatables library. The library will be installed via the npm -install command
Part 3: Set up the Angular Datatables module on the Home page. Follow the Angular Datatables documentation to configure server-side pagination against a REST API Person endpoint in the cloud.
Part 4: Set up the Angular Datatables module on the About page. Configure server-side pagination against an ASP.NET CORE/REST API Position endpoint running on the localhost that has 100k + records.
At the end of each tutorial part, I include a complementary screencast with background music (work in progress) so you can see how it was done on my desktop. Grab a drink and relax while watching the videos!
Related Tutorials
The focus of this tutorial is on Angular pagination. Two other related tutorials are
- NetCore 5.0 REST API Pagination 100,000+ Rows
- Angular 11 CRUD with .Net 5 REST API Tutorial
- Angular 11 Modal Form, Dialog, and Toaster with Bootstrap
Opensource Project Highlights
Angular DataTables is a table library with 1.5k+ stars on Github. The library supports Angular2+ to build complex HTML tables, including filter, sort, and paging. The developer Louis LIN, based in Paris, maintains the repo and provides excellent online documentation.
You can show your appreciation to Louis LIN by giving a “star” on his Github Repo.
Server-Side Pagination Overview
To address pagination, Angular DataTables provide a method to let all of the “heavy lifting” be done by a database engine on the server-side (they are after all, highly optimized to be used exactly for this case!), and then have that information drawn in the user’s web-browser. Consequently, it can display tables consisting of millions of rows with ease.
As shown in Figure 1, when using server-side processing, DataTables will make an Ajax request to the server for each draw of the information on the page (i.e. when paging, ordering, searching, etc.). DataTables will send a number of variables to the server to instruct it to perform the required processing and then return the data in JSON format to DataTables for display.
Sent Parameters — When making a request to the server using server-side processing, DataTables will send the input parameters such as columns, draw, length, order, and search, to let the server know what data to query.
Returned Data — DataTables expect a return of data in JSON format, including fields such as draw, recordTotal, recordFiltered, data, and error.

For more information about Clients-ApiResources-TokenService architecture for building scalable and maintainable modern applications, see CAT architecture pattern for modern app SPA/Mobile.
Prerequisites
The following tools/skills are recommended
- Visual Code — free editor for Angular source code.
- Ngx-Rocket — opensource Angular generator to scaffold new Angular app.
- Visual Studio 2019 Community —free editor for ASP.NET Core WebAPI C#.
- Familiarity with TypeScript and C#.
Let’s get started!
Part 1 — Create Angular app with Ngx-Rocket template
Ngx-Rocket is a high-quality starter template that Angular developers can use to quickly scaffold an Angular app with boilerplate code. The included enterprise features are responsive design, routing, authentication, HTTPS service extensions, i18n support, and more.
Task 1 .1— Install Ngx-Rocket generator
To install Ngx-Rocket generator (see Figure 2 for visual aids):
- Open command prompt
- Type in npm install -g generator-ngx-rocket
- Hit Enter key

Task 1.2 — Scaffold new Angular app
To scaffold a new Angular app using Ngx-Rocket generator, follow these steps:
- Create folder C:\apps\devkit\Clients\AngularNgxDataTable
- Open the command prompt and change to C:\apps\devkit\Clients\AngularNgxDataTable
- Type in “ngx new” and hit Enter
- When prompt for input parameters, use the settings as shown in Figure 3

The Ngx-Rocket generator will first scaffold the Angular app and then automatically run npm -install command to restore npm packages afterward.
Screencast of Part 1
The complementary Youtube video (Figure 4) is a record of the steps in this part of the tutorial. If you find the video helpful, please like and subscribe.












