Bird
0
0

Which of the following is the correct syntax to lazy load a module named OrdersModule located at ./orders/orders.module?

easy📝 Syntax Q3 of 15
Angular - Routing
Which of the following is the correct syntax to lazy load a module named OrdersModule located at ./orders/orders.module?
A{ path: 'orders', component: OrdersModule }
B{ path: 'orders', loadChildren: () => import('./orders/orders.module').then(m => m.OrdersModule) }
C{ path: 'orders', loadChildren: './orders/orders.module#OrdersModule' }
D{ path: 'orders', loadChildren: import('./orders/orders.module') }
Step-by-Step Solution
Solution:
  1. Step 1: Recall modern lazy loading syntax

    Angular uses dynamic import with a function returning a promise and then() to get the module.
  2. Step 2: Match syntax to options

    { path: 'orders', loadChildren: () => import('./orders/orders.module').then(m => m.OrdersModule) } uses the correct arrow function with import and then to return OrdersModule.
  3. Final Answer:

    { path: 'orders', loadChildren: () => import('./orders/orders.module').then(m => m.OrdersModule) } -> Option B
  4. Quick Check:

    Correct lazy load syntax = C [OK]
Quick Trick: Use arrow function with import().then() for lazy loading [OK]
Common Mistakes:
MISTAKES
  • Using string syntax with # (deprecated)
  • Assigning component instead of loadChildren
  • Calling import() without then()

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes