Today, we will learn about implementing Custom pagination in Angular 8. As Angular 8 is officially released by Google.


  • Basic knowledge of Angular 8
  • Code editor like Visual studio code

So, lets get started:

Create a new project in angular 8 by typing the following command.

ng new custom-pagination-angular

Now, open the newly created project and install the jw-pagination package. It provides good control over pagination.

npm install jw-angular-pagination

Open the app.module.ts file and add the JwPaginationComponent in the file.

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { JwPaginationComponent } from 'jw-angular-pagination';
import { AppComponent } from './app.component';

  declarations: [
  imports: [
  providers: [],
  bootstrap: [AppComponent]
export class AppModule { }

Open the app.component.ts file and add the code in it.

import { Component } from '@angular/core';

  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
export class AppComponent {
  title = 'custom-pagination-angular';
  data = [];
  pagedItems: Array<any>;

  constructor() { }

  ngOnInit() { = Array(1000).fill(0).map((x, i) => ({ id: (i + 1), name: `Item Paged ${i + 1}`, product: `Product ${i + 1}` }));
  beginPagination(pagedItems: Array<any>) {
    this.pagedItems = pagedItems;

Open the app.component.html file and add the html in it.

<div class="card text-center m-3">
  <h3 class="card-header">Angular 8 Custom Pagination Example</h3>
  <div class="card-body">
      <div *ngFor="let item of pagedItems">{{}} for {{item.product}}</div>
  <div class="card-footer pb-0 pt-3">
      <jw-pagination [items]="data" (changePage)="beginPagination($event)"></jw-pagination>

You can also add the bootstrap and jquery reference in it.

<!doctype html>
<html lang="en">
  <meta charset="utf-8">
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <link rel="stylesheet" href="">
  <script src=""></script>
  <script src=""></script>
  <script src=""></script>

That’s it.

custom pagination angular8