-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Learning Angular, Fourth Edition
By :

So far, we have covered basic routing, with route parameters as well as query parameters. The Angular router is quite capable, though, and able to do much more, such as the following:
In the following sections, we will learn about all these techniques in more detail.
When we want to prevent unauthorized access to a particular route, we use a specific Angular service called a guard. To create a guard, we use the generate command of the Angular CLI, passing its name as a parameter. To create a guard that will allow access to a route depending on whether the user is authenticated or not, we will run the following command in the src\app\auth
folder:
ng generate guard auth
When we execute the previous command, the Angular...