If you want to prevent navigation away from a component under certain conditions, which Route Guard would you use?

  • CanActivate
  • CanActivateChild
  • CanDeactivate
  • CanLoad
To prevent navigation away from a component under certain conditions, you would use the 'CanDeactivate' Route Guard. This guard allows you to check if it's safe to leave the current route or component and can be useful for scenarios like unsaved changes in a form where you want to confirm with the user before leaving the page. The other guards serve different purposes, such as allowing or denying access to routes or modules.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *