Bird
0
0

Which of the following is the correct syntax to pass a parameter named 'format' with value 'short' to a pipe called 'dateFormat'?

easy📝 Syntax Q3 of 15
Angular - Pipes
Which of the following is the correct syntax to pass a parameter named 'format' with value 'short' to a pipe called 'dateFormat'?
A{{ today | dateFormat:'short' }}
B{{ today | dateFormat(format='short') }}
C{{ today | dateFormat[short] }}
D{{ today | dateFormat{format:'short'} }}
Step-by-Step Solution
Solution:
  1. Step 1: Recall Angular pipe parameter syntax

    Parameters are passed after the pipe name using colons and quotes for strings.
  2. Step 2: Match correct syntax

    {{ today | dateFormat:'short' }} uses colon and quotes correctly; others use invalid syntax.
  3. Final Answer:

    {{ today | dateFormat:'short' }} -> Option A
  4. Quick Check:

    Pipe param syntax = colon + quotes [OK]
Quick Trick: Use colon and quotes for string parameters [OK]
Common Mistakes:
  • Using parentheses like function calls
  • Using brackets or braces incorrectly
  • Omitting quotes around string parameters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes