Bird
0
0

Which Angular directive is commonly used as a placeholder to insert a dynamically loaded component?

easy📝 Conceptual Q2 of 15
Angular - Advanced Patterns
Which Angular directive is commonly used as a placeholder to insert a dynamically loaded component?
A<app-root>
B<ng-template>
C<router-outlet>
D<ng-content>
Step-by-Step Solution
Solution:
  1. Step 1: Identify placeholder directives for dynamic content

    <ng-template> is designed to hold template content that can be rendered later.
  2. Step 2: Compare with other options

    <ng-content> projects content, router-outlet is for routing, app-root is root component, so only <ng-template> fits dynamic insertion.
  3. Final Answer:

    <ng-template> -> Option B
  4. Quick Check:

    Placeholder for dynamic components = <ng-template> [OK]
Quick Trick: Use <ng-template> as a placeholder for dynamic components [OK]
Common Mistakes:
  • Using <ng-content> which is for content projection
  • Confusing router-outlet with dynamic component insertion
  • Thinking <app-root> is a placeholder

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes