Angular CLI gets projects up and running quickly. If we’re building any substantial web application, soon we’ll need to add routing for displaying different views. To add routing, follow the steps below after generating an Angular CLI project.
Open a terminal in the root directory of the application and create a dashboard component: ng g component dashboard
Open index.html and ensure there is a <base href="/"> tag at the top of the head section.
In the root directory of the application, run the command: ng g module app-routing
Open app-routing.module.ts and paste the following configuration: