Bird
0
0

In Angular routing, what is the main role of the canActivate guard?

easy🧠 Conceptual Q1 of 15
Angular - Routing
In Angular routing, what is the main role of the canActivate guard?
ATo handle errors during navigation
BTo check if a user can leave a route after editing
CTo preload data before route activation
DTo determine if a route can be accessed before activation
Step-by-Step Solution
Solution:
  1. Step 1: Understand canActivate

    The canActivate guard is used to decide if a route can be entered or not.
  2. Step 2: Differentiate from other guards

    canDeactivate controls leaving a route, not entering it.
  3. Final Answer:

    To determine if a route can be accessed before activation -> Option D
  4. Quick Check:

    canActivate controls route entry [OK]
Quick Trick: canActivate controls route entry permission [OK]
Common Mistakes:
MISTAKES
  • Confusing canActivate with canDeactivate
  • Thinking canActivate handles data preloading
  • Assuming canActivate manages navigation errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes