In Angular 14, we can do this by using router guards. This is not an intro to Angular guards, so if you are not familiar with them, you can read more about them in the official documentation. In this article, we will see how we can create configurable Angular guards. We will create a guard that will check if the logged in user has a specific role.
Table of contents
Configurable class-based guardConfigurable function-based guardHow to test the guardsSort: