Canactivate v/s canload in angular
Nov 6 · 1 min read
- CanActivate: Controls if a route can be activated.
- CanLoad: Controls if a route can even be loaded. This becomes useful for feature modules that are lazy loaded. They won’t even load if the guard returns false.
Route guards are most often implemented as classes that implement the needed route guard interface. Let’s see an example with a CanActivate route guard where we ask an auth service if the user is authenticated:
