In this video we will discuss, How routing works in an angular application.
As you have seen in our previous video, there are many small steps that you have to remember, to implement routing correctly in an angular application. Let’s quickly recap those steps.
Step 1 : Set base href in index.html.
Step 2 : Import the RouterModule into the application root module AppModule.
Step 3 : Configure the application routes.
Step 4 : Specify where you want the routed component view template to be displayed using the router-outlet directive
Step 5 : Create a navigation menu and tie the configured routes with the menu using the routerLink directive. Optionally, use the routerLinkActive directive to style the current route that is active, so the user knows the page that he is on, in the application.
Now, let’s connect all these small steps and see how routing actually works.
1. We have built the “Home” and “Employees” links using the RouterLink directive. The RouterLink directive …