Bird
0
0

You want to lazy load a module only after the user logs in. Which approach best achieves this?

hard📝 Conceptual Q8 of 15
Angular - Modules
You want to lazy load a module only after the user logs in. Which approach best achieves this?
AUse a service to manually import the module after login
BLoad the module eagerly and hide its components until login
CUse a route guard on the lazy loaded route to check login before loading
DPreload the module on app start but disable its routes
Step-by-Step Solution
Solution:
  1. Step 1: Understand lazy loading with login control

    Route guards can prevent loading routes until conditions like login are met.
  2. Step 2: Evaluate options

    Use a route guard on the lazy loaded route to check login before loading uses a guard to delay loading until login, which is best practice.
  3. Final Answer:

    Use a route guard on the lazy loaded route to check login before loading -> Option C
  4. Quick Check:

    Route guard controls lazy loading on login [OK]
Quick Trick: Use route guards to control lazy loading access [OK]
Common Mistakes:
  • Loading modules eagerly instead of lazy
  • Trying to preload but disable routes
  • Manually importing modules outside routing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes