O'Reilly logo

Hands-on Full Stack Development with Angular 5 and Firebase by Uttam Agarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding authentication guards

Guard are a really useful feature in Angular for protecting routes. They provide the security feature used to restrict resources in our application so that the user is not able to consume a resource without proper permission.

There are different guard types in Angular:

  • CanActivate: This is used to decide whether the route can be activated
  • CanActivateChild: This is used to decide whether the child route can be activated
  • CanDeactivate: This is used to decide whether the route can be deactivated
  • CanLoad: This is used to decide whether the module can be loaded lazily

We will take a look at an example of the CanActivate guard in authentication. We will allow the user to access the user profile and friends pages only ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required