In this section, you’ll learn how to use the
Angular Router with Apollo to implement some navigation functionality!
The Angular Router is an optional service that is already installed thanks to
Before you’re moving on to configure the different routes for your application, you need to create a
Header component that users can use to navigate between the various parts of your app.
This renders merely two
router-link that users can use to navigate between the
LinkListComponent and the
You’ll configure the different routes for the app in
Let’s take a closer look to understand better what’s going on:
LinkListComponentcomponents which will be rendered for different routes
You now need to make some small updates to
You need to update one more file,
That’s it. You can now access two URLs:
http://localhost:4200/ will render
http://localhost:4200/create will render the
CreateLinkComponent component you just wrote in the previous section.
To wrap up this section, you need to implement an automatic redirect from
LinkListComponent after a mutation is performed.
After the mutation is performed, the angular router (
Router service) will now navigate back to the
LinkListComponent component that’s accessible on the root route: