Bird
0
0

Why does this lazy loading route cause an error?

medium📝 Debug Q7 of 15
Angular - Standalone Components
Why does this lazy loading route cause an error?
{ path: 'about', loadComponent: () => import('./about.component').then(m => m.AboutModule) }
AIt tries to load a module instead of a standalone component.
BThe import path is incorrect.
CloadComponent cannot be used with arrow functions.
DThe route path 'about' is reserved.
Step-by-Step Solution
Solution:
  1. Step 1: Understand loadComponent expects a component

    loadComponent must load a standalone component, not a module.
  2. Step 2: Analyze the code

    The code loads 'AboutModule' which is a module, causing an error.
  3. Final Answer:

    It tries to load a module instead of a standalone component. -> Option A
  4. Quick Check:

    loadComponent loads components, not modules [OK]
Quick Trick: loadComponent must load a component, not a module [OK]
Common Mistakes:
  • Confusing modules with components in lazy loading
  • Assuming arrow functions are invalid
  • Thinking route paths are reserved keywords

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes