import { NgModule } from '@angular/core' ; import { Routes , RouterModule } from '@angular/router' ; const routes = [ { path : '' , redirectTo : '/home' , pathMatch : 'full' } , { path : 'home' , loadChildren : './pages/home/home.module#HomeModule' } , { path : 'detail/:id' , loadChildren : './pages/detail/detail.module#DetailModule' } ] ; @ NgModule ( { imports : [ RouterModule . forRoot ( routes , { scrollPositionRestoration : 'enabled' , relativeLinkResolution : 'legacy' } ) ] , exports : [ RouterModule ] } ) export class AppRoutingModule { }