In this section, you will learn the important building blocks of the router. The important building blocks are base href, Router Outlet, routerLink, and routerLinkActive.
Let's now analyze each of the building blocks of the router library:
- base href: We must set the base directive in the index.html page. This is a mandatory step. Without the base tag, the browser may not be able to load resources (images, CSS, and scripts) when deep linking into the app.
In our application, we need to define the base href inside the <head> tag in our index.html file:
<base href="/“>
- Defining the router-outlet: The router-outlet directive is the placeholder for containing the loaded data of the view. Inside the router-outlet ...