import { NgModule } from '@angular/core' ; import { Routes , RouterModule } from '@angular/router' ; import { PlaygroundComponent } from './playground.component' ; import { OneComponent } from './one/one.component' ; import { TwoComponent } from './two/two.component' ; import { ThreeComponent } from './three/three.component' ; import { FormDemoComponent } from './form-demo/form-demo.component' ; const routes = [ { path : '' , component : PlaygroundComponent , children : [ { path : 'one' , component : OneComponent , children : [ { path : 'three' , component : ThreeComponent } ] } , { path : 'two' , component : TwoComponent , children : [ { path : 'form' , component : FormDemoComponent } ] } ] } , ] ; @ NgModule ( { imports : [ RouterModule . forChild ( routes ) ] , exports : [ RouterModule ] , } ) export class PlaygroundRoutingModule { } export const routedComponents = [ PlaygroundComponent ] ;