Collections
pluck
Project own direct properties from record lists.
Use it in your component
Standalone component
import { Component } from '@angular/core';
import { JsonPipe } from '@angular/common';
import { PluckPipe } from 'extra-pipe';
@Component({
standalone: true,
imports: [PluckPipe, JsonPipe],
template: `{{ [{"id":1},{"id":2}] | pluck: "id" | json }}`,
})
export class ExampleComponent {
}
Template
{{ [{"id":1},{"id":2}] | pluck: "id" | 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: key. Locale is controlled separately.
This pipe has no locale override.
Live template data
readonly value = [
{
"id": 1
},
{
"id": 2
}
] as const;
readonly parameter0 = "id";
{{ value | pluck: parameter0 | json }}
Rendered output
[
1,
2
]