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 (app.module.ts). The following is a sample code which represents an anchor tag with attribute bindings for routerLink representing the route definitions having both fixed (/login and /register) and dynamic URL paths (doctors/PHYSICIAN). Anchor tags are then followed by the router-outlet
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access