NG.I · Angular 22 practice question

A developer needs to create a custom Angular pipe that converts a user's full name into a specific format within a template. To correctly define this pipe, what fundamental structural requirements must the TypeScript class satisfy?

import {Pipe, PipeTransform} from '@angular/core';
@Pipe({name: 'nameFormatter'}) export class NameFormatterPipe implements PipeTransform {
  transform(value: string): string { return value; }
}
Choose one answer
Check answer and explanation

Correct answer: It must implement the PipeTransform interface and include a method named 'transform' to handle the value manipulation.

Explanation

The required implementation necessitates that the class adheres to the 'PipeTransform interface' and contains a method named 'transform' for value manipulation.

Common trap

The suggestion to use a public method called 'apply' instead of 'transform' is incorrect, and the idea of extending a base class instead of implementing an interface is also flawed.

Source: Angular docs: Pipes — Creating custom pipes
Checked against the cited text on 2026-11-25.

Report an error in this question