import { NgModule } from '@angular/core' ; import { Routes , RouterModule } from '@angular/router' ; import { HomeComponent } from './home/home.component' ; import { LayoutComponent } from './layout/layout.component' ; import { MainComponent } from './main/main.component' ; const routes = [ { path : '' , component : LayoutComponent , children : [ { path : '' , component : MainComponent , pathMatch : 'full' } , { path : 'home' , component : HomeComponent } ] } ] ; @ NgModule ( { imports : [ RouterModule . forRoot ( routes ) ] , exports : [ RouterModule ] } ) export class AppRoutingModule { }