Bird
0
0

What is wrong with this standalone pipe declaration?

medium📝 Debug Q6 of 15
Angular - Standalone Components
What is wrong with this standalone pipe declaration?
@Pipe({name: 'reverse', standalone: true})
export class ReversePipe {
  transform(value: string): string {
    return value.split('').reverse().join('');
  }
}

When used in a component without importing it, what error occurs?
ASyntax error in pipe declaration
BNo error, pipe works fine
CError: The pipe 'reverse' could not be found
DRuntime error: Cannot read property 'split' of undefined
Step-by-Step Solution
Solution:
  1. Step 1: Check pipe declaration

    The pipe is correctly declared as standalone.
  2. Step 2: Understand usage without import

    If the pipe is not imported into the component, Angular cannot find it and throws an error.
  3. Final Answer:

    Error: The pipe 'reverse' could not be found -> Option C
  4. Quick Check:

    Missing import causes pipe not found error [OK]
Quick Trick: Always import standalone pipes before use [OK]
Common Mistakes:
  • Assuming standalone pipes auto-import
  • Thinking syntax error exists in code
  • Confusing runtime errors with missing import errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes