← All pipes
Collections

chunk

Group cards into fixed-size display rows.

Use it in your component

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

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

}

Template
{{ [1,2,3] | chunk: 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: size. Locale is controlled separately.
This pipe has no locale override.
Live template data
readonly value = [
  1,
  2,
  3
] as const;
readonly parameter0 = 2;
{{ value | chunk: parameter0 | json }}

Rendered output

[
  [
    1,
    2
  ],
  [
    3
  ]
]