Bird
0
0

What will happen if a canDeactivate guard returns a Promise that resolves to true?

medium📝 component behavior Q5 of 15
Angular - Routing
What will happen if a canDeactivate guard returns a Promise that resolves to true?
ANavigation is blocked immediately
BNavigation away from the route is allowed after the promise resolves
CNavigation proceeds before the promise resolves
DAn error occurs because promises are not supported
Step-by-Step Solution
Solution:
  1. Step 1: Understand async guard behavior

    Angular supports guards returning promises or observables to allow async checks.
  2. Step 2: Interpret promise resolving to true

    When the promise resolves to true, navigation is allowed to proceed.
  3. Final Answer:

    Navigation away from the route is allowed after the promise resolves -> Option B
  4. Quick Check:

    canDeactivate async true = allow navigation [OK]
Quick Trick: Async guards can return promises; true allows navigation [OK]
Common Mistakes:
MISTAKES
  • Thinking navigation blocks immediately
  • Assuming navigation ignores async guards
  • Believing promises cause errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes