Bird
0
0

What is wrong with this Angular template code?

medium📝 Debug Q14 of 15
Angular - Pipes
What is wrong with this Angular template code?
{{ user.birthdate | date:shortDate }}
AThe variable name cannot have a dot
BThe pipe symbol should be a colon
CThe pipe parameter should be a string in quotes
DThe date pipe cannot format birthdate
Step-by-Step Solution
Solution:
  1. Step 1: Check pipe parameter syntax

    Pipe parameters must be strings in single or double quotes, so shortDate should be 'shortDate'.
  2. Step 2: Verify other parts

    The pipe symbol is correct, variable names can have dots for properties, and date pipe can format dates.
  3. Final Answer:

    The pipe parameter should be a string in quotes -> Option C
  4. Quick Check:

    Pipe parameters need quotes [OK]
Quick Trick: Always quote pipe parameters like 'shortDate' [OK]
Common Mistakes:
  • Omitting quotes around pipe parameters
  • Replacing pipe symbol with colon
  • Misunderstanding variable property access

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes