← All pipes
Collections

paginate

Generate page items and total-page metadata for client display.

Use it in your component

Standalone component
import { Component } from '@angular/core';
import { JsonPipe } from '@angular/common';
import { PaginatePipe } from 'extra-pipe';

@Component({
  standalone: true,
  imports: [PaginatePipe, JsonPipe],
  template: `{{ [1,2,3] | paginate: 1: 2 | json }}`,
})
export class ExampleComponent {

}

Template
{{ [1,2,3] | paginate: 1: 2 | json }}

Try it live.

The output below runs the packed library. Edit data, not code.

Use double quotes for text, or a number, array, object or null.
Ordered parameters: page, pageSize. Locale is controlled separately.
This pipe has no locale override.
Live template data
readonly value = [
  1,
  2,
  3
] as const;
readonly parameter0 = 1;
readonly parameter1 = 2;
{{ value | paginate: parameter0: parameter1 | json }}

Rendered output

{
  "items": [
    1,
    2
  ],
  "page": 1,
  "pageSize": 2,
  "totalItems": 3,
  "totalPages": 2
}