Router Guards enable further decoupling and reuse of logic and greater control over the component lifecycle.
Here are the four major guards you will most likely use:
- CanActivate and CanActivateChild, used for checking auth access to a route
- CanDeactivate, used to ask permission before navigating away from a route
- Resolve, allows for pre-fetching of data from route parameters
- CanLoad, allows for custom logic to execute before loading feature module assets
Refer to the following sections for how to leverage CanActivate and CanLoad . Resolve guard will be covered in Chapter 10, Angular App Design and Recipes.