RouterLink for navigation
In this section, we will learn about the different techniques used for navigating route definitions having URL paths such as the following:
- Fixed or static navigation paths such as
/doctors
 and/hospitals
- Dynamic navigation paths such as
/doctors/PEDIATRICIAN
or, rather,/doctors/:specialitycode
, where the specialty code is the dynamic parameter
The following are the two key concepts which need to be understood in relation to navigating fixed or dynamic navigation paths, as mentioned earlier:
RouterLink
ActivatedRoute
Â
What is RouterLink?
Once the route definitions have been configured, and the router outlet is defined to render the routes, the next requisite step is to determine a way to navigate to these routes. This is where RouterLink
comes into the picture.
RouterLink
is a directive which is used with the anchor tag. It helps in navigating to different views based on the route paths (both, fixed and dynamic) configured as part of the route definitions in AppModule
...