Bird
0
0

Given this canActivate guard that returns false, what happens when navigating to the guarded route?

medium📝 component behavior Q4 of 15
Angular - Routing
Given this canActivate guard that returns false, what happens when navigating to the guarded route?
AAn error is thrown and app crashes
BNavigation proceeds to the route anyway
CNavigation is cancelled and user stays on current page
DThe route loads but with limited access
Step-by-Step Solution
Solution:
  1. Step 1: Understand canActivate return values

    If canActivate returns false, navigation is blocked.
  2. Step 2: Predict navigation behavior

    User stays on the current page; no error or partial loading occurs.
  3. Final Answer:

    Navigation is cancelled and user stays on current page -> Option C
  4. Quick Check:

    canActivate false = block navigation [OK]
Quick Trick: canActivate false blocks navigation, no errors thrown [OK]
Common Mistakes:
MISTAKES
  • Assuming navigation proceeds despite false
  • Expecting an error or crash
  • Thinking partial route loads

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes