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.
Loading...
Related Quiz
- What does the term "Hierarchical Injector" refer to in Angular?
- Lazy loading in Angular allows you to load feature modules on-demand using the ________ property in the route configuration.
- Your application has a module that is loaded lazily, and you want to ensure that this module is only loaded for administrators. How would you implement this restriction?
- In template-driven forms, the ______ directive is used to group controls and aggregate their values and validation status.
- Which Angular CLI command is used to generate a new service?