Working with route parameters
Whether it is about building a REST API using Node.js or configuring routes in Angular, setting up routes is an absolute art, especially when it comes to working with parameters. In this recipe, you’ll create some routes with parameters and will learn how to get those parameters in your components once the route is active.
Getting ready
The app that we are going to work with resides in start/apps/chapter07/ng-route-params
inside the cloned repository:
- Open the code repository in your code editor.
- Open the terminal, navigate to the code repository directory, and run the following command to serve the project:
npm run serve ng-route-guards
This should open the app in a new browser tab. You should see the following:
Figure 7.13: The ng-route-params app running on localhost:4200
Now that we have the app running locally, let’s see the steps of the recipe in the next section.