Routing from one view to another is facilitated in Angular by use of a router. The links of a view component can be bound to the router, which will then trigger the configured routes. Route configuration is done by creating and exporting routes. For our sample application, we can create a routing module and then import this module into the root module (AppModule). Here's how a routing module app-routing.module.ts for the dashboard sample looks:
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
const routes: Routes = [];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
In order to start defining routes, we need to populate the routes with mappings. When the route or URL changes, a component mapped to the route can be rendered on the page...