Bird
0
0

Given this standalone pipe:

medium📝 component behavior Q13 of 15
Angular - Standalone Components
Given this standalone pipe:
@Pipe({name: 'exclaim', standalone: true})
export class ExclaimPipe implements PipeTransform {
  transform(value: string): string {
    return value + '!';
  }
}

What will be the output of this template?
<div>{{ 'Hello' | exclaim }}</div>
AError: Pipe 'exclaim' not found
B<div>Hello!</div>
C<div>Hello</div>
D<div>Hello!!</div>
Step-by-Step Solution
Solution:
  1. Step 1: Check pipe declaration and usage

    The pipe is standalone and must be imported into the component using it.
  2. Step 2: Analyze template usage without import

    If the component does not import the standalone pipe, Angular will not recognize it, causing an error.
  3. Final Answer:

    Error: Pipe 'exclaim' not found -> Option A
  4. Quick Check:

    Standalone pipe must be imported to use [OK]
Quick Trick: Standalone pipes need explicit import in component [OK]
Common Mistakes:
  • Assuming standalone pipes auto-import
  • Expecting output without importing pipe
  • Confusing pipe transform logic with usage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes