Router Guards

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:

  1. CanActivate and CanActivateChildused for checking auth access to a route
  2. CanDeactivate, used to ask permission before navigating away from a route
  3. Resolve, allows for pre-fetching of data from route parameters
  4. 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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.20.224.107