Each route may have various types of guards that are called at different times in the lifetime of an activated route. They may stop the current task, and/or perform certain activities before the current routing task continues. Each guard type is a service that implements a specific interface. Moreover, each guard is passed in a dedicated property of the route the guard must be applied to.
The following is a list of all available guards:
- CanActivate interface. Method to implement: canActivate. Route property where to place the implementation: canActivate. Used to prevent access to a route when certain conditions are not verified, for instance, when a user is not authenticated. An example of implementation is as follows: