Bird
0
0

What will be the output of this Angular template?

medium📝 component behavior Q5 of 15
Angular - Fundamentals
What will be the output of this Angular template?
@Component({ selector: 'app-list', template: `
  • {{ item }}
` }) export class ListComponent { items = ['A', 'B', 'C']; }
A<ul><li></li><li></li><li></li></ul>
B<ul><li>items</li></ul>
C<ul><li>A</li><li>B</li><li>C</li></ul>
DError: *ngFor syntax invalid
Step-by-Step Solution
Solution:
  1. Step 1: Understand *ngFor directive

    *ngFor loops over the 'items' array and creates an
  2. for each element.
  3. Step 2: Check array contents

    The array contains ['A', 'B', 'C'], so the template renders three
  4. elements with these values.
  5. Final Answer:

    The output is
    • A
    • B
    • C
    .
    -> Option C
  6. Quick Check:

    *ngFor loops render list items [OK]
Quick Trick: *ngFor repeats template for each array item [OK]
Common Mistakes:
  • Expecting 'items' text instead of values
  • Misunderstanding *ngFor syntax
  • Assuming empty list output

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes