Bird
0
0

Identify the mistake in this Angular pipe decorator:

medium📝 Debug Q6 of 15
Angular - Pipes
Identify the mistake in this Angular pipe decorator:
@Pipe({name: 'filterPipe', pure: 'true'})
AThe pipe name cannot contain uppercase letters
BThe 'name' property must be capitalized
CThe decorator should be @PipeTransform, not @Pipe
DThe 'pure' property should be a boolean, not a string
Step-by-Step Solution
Solution:
  1. Step 1: Check property types

    The 'pure' property expects a boolean value, not a string.
  2. Step 2: Validate other options

    The 'name' property must be capitalized is incorrect because 'name' is case-sensitive but lowercase is valid. The decorator should be @PipeTransform, not @Pipe confuses decorator with interface. The pipe name cannot contain uppercase letters is false; pipe names can have lowercase letters.
  3. Final Answer:

    The 'pure' property should be a boolean, not a string -> Option D
  4. Quick Check:

    Boolean values for 'pure' property only [OK]
Quick Trick: 'pure' must be boolean true/false, not string [OK]
Common Mistakes:
  • Using string instead of boolean for 'pure'
  • Confusing decorator and interface
  • Misunderstanding pipe naming rules

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes