Bird
0
0

Identify the error in this template snippet:

medium📝 Debug Q6 of 15
Angular - Directives
Identify the error in this template snippet:
<li *ngFor="let item in items">{{item}}</li>
AMissing parentheses around items
BIncorrect keyword 'in' should be 'of'
CLoop variable must be declared with 'var' not 'let'
DNo error, syntax is correct
Step-by-Step Solution
Solution:
  1. Step 1: Check the loop syntax

    Angular requires let item of items, not in.

  2. Step 2: Confirm other syntax parts

    No parentheses needed, and let is correct for declaring the variable.

  3. Final Answer:

    Incorrect keyword 'in' should be 'of' -> Option B
  4. Quick Check:

    Use 'of' not 'in' in *ngFor [OK]
Quick Trick: Use 'of' keyword in *ngFor loops, not 'in' [OK]
Common Mistakes:
  • Using 'in' instead of 'of'
  • Adding unnecessary parentheses
  • Using 'var' instead of 'let'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes