← All pipes
Utilities

pick

Display explicitly allowed own fields.

Use it in your component

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

@Component({
  standalone: true,
  imports: [PickPipe, JsonPipe],
  template: `{{ {"id":1,"name":"Ana"} | pick: ["name"] | json }}`,
})
export class ExampleComponent {

}

Template
{{ {"id":1,"name":"Ana"} | pick: ["name"] | 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: keys. Locale is controlled separately.
This pipe has no locale override.
Live template data
readonly value = {
  "id": 1,
  "name": "Ana"
} as const;
readonly parameter0 = ["name"] as const;
{{ value | pick: parameter0 | json }}

Rendered output

{
  "name": "Ana"
}