import { NgModule } from '@angular/core' ; import { Routes , RouterModule } from '@angular/router' ; const routes = [ { path : '' , redirectTo : '/books' , pathMatch : 'full' } , { path : 'books' , loadChildren : ( ) => import ( './books/books.module' ) . then ( m => m . BooksModule ) } , { path : 'counter' , loadChildren : ( ) => import ( './counter/counter.module' ) . then ( m => m . CounterModule ) , } , ] ; @ NgModule ( { imports : [ RouterModule . forRoot ( routes ) ] , exports : [ RouterModule ] , } ) export class AppRoutingModule { }