Bird
0
0

Why does this lazy loading route cause an error?

medium📝 Debug Q7 of 15
Angular - Modules
Why does this lazy loading route cause an error?
{ path: 'reports', loadChildren: () => import('./reports/reports.module').then(m => m.ReportModule) }
AThe module class name is incorrect; should be ReportsModule
BThe import path must be absolute, not relative
CloadChildren must be a string, not a function
DMissing RouterModule import in AppModule
Step-by-Step Solution
Solution:
  1. Step 1: Check module class name consistency

    The import uses 'ReportModule' but the file likely exports 'ReportsModule'.
  2. Step 2: Understand impact

    Incorrect class name causes module not found error at runtime.
  3. Final Answer:

    The module class name is incorrect; should be ReportsModule -> Option A
  4. Quick Check:

    Module class name must match export [OK]
Quick Trick: Match module class name exactly in import.then() [OK]
Common Mistakes:
  • Typos in module class names
  • Wrong import path assumptions
  • Confusing function vs string syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes