-
Notifications
You must be signed in to change notification settings - Fork 91
Expand file tree
/
Copy pathAngular_notes_ep_48.txt
More file actions
30 lines (21 loc) · 1005 Bytes
/
Copy pathAngular_notes_ep_48.txt
File metadata and controls
30 lines (21 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Episode # 48 - Route Guards
1. Route Guards helps us secure our routes and screens
2. E.g
User -> Route Guard -> /Admin
-> Custom Logic
-> True -> Admin
-> can access the route
-> False
-> custom logic on failure condition -> home
3. Generate Route Guard
ng g guard <guard_name>
4. Route Guards have something called "interfaces"
- canActivate -> can a user access a route
- canActivateChild -> can user access child routes of a parent route
- canDecativate -> check if user can exit the route
- canLoad -> Can a lazy loaded module be loaded
- resolve -> route data retrival before route activating
5. I will cover all of these in detail in coming episodes
- quick examples
- use cases
6. We can implement more than 1 guards in our application