import { NgModule } from '@angular/core' ; import { RouterModule , Routes } from '@angular/router' ; import { DashboardComponent } from './dashboard.component' ; import { CarDetailComponent } from './car-detail.component' ; const routes = [ { path : '' , redirectTo : '/dashboard' , pathMatch : 'full' } , { path : 'dashboard' , component : DashboardComponent } , { path : 'detail' , component : CarDetailComponent } ] ; @ NgModule ( { imports : [ RouterModule . forRoot ( routes ) ] , exports : [ RouterModule ] } ) export class AppRoutingModule { }