Coding task · Angular course · Module 12: Security and Performance

Practice: Auth Guard

A functional guard is a constant typed with a type from @angular/router (the one adminGuard already uses). inject() retrieves services. Instead of calling navigation, the guard returns a URL tree (UrlTree) that the Router builds from an array of segments, and Angular redirects on its own.

Task

Complete the guard that checks for the administrator role.