Collections
zip
Pair parallel data series to the shorter length.
Use it in your component
Standalone component
import { Component } from '@angular/core';
import { JsonPipe } from '@angular/common';
import { ZipPipe } from 'extra-pipe';
@Component({
standalone: true,
imports: [ZipPipe, JsonPipe],
template: `{{ [1,2] | zip: ["A","B"] | json }}`,
})
export class ExampleComponent {
}
Template
{{ [1,2] | zip: ["A","B"] | 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: other. Locale is controlled separately.
This pipe has no locale override.
Live template data
readonly value = [
1,
2
] as const;
readonly parameter0 = ["A","B"] as const;
{{ value | zip: parameter0 | json }}
Rendered output
[
[
1,
"A"
],
[
2,
"B"
]
]