The Angular CanActivate route guard runs before we navigate to a route allowing us to cancel the navigation. In this lecture, you will learn what is CanActivate route guard and how to use it to protect the route.
The Angular CanActivate guard decides, if a route can be activated ( or component can be rendered) or not. We use this guard, when we want to check on some condition, before activating the component or showing it to the user. This also allows us to cancel the navigation if the condition fails.
One of the use case of this CanActivate route guard is to check if the user has logged in to the application or not. If user has not logged in, then the CanActivate route guard can redirect him to login page.
In this lecture you will learn:
1. What is CanActivate Route Guard?
2. Where to use CanActivate Route guard?
3. How to implement CanActivate Route guard to protect a route.
DOWNLOAD SECTION SOURCE CODE HERE: drive.google.com/file/d/16SYO...
20 мар 2022