import { NgModule } from '@angular/core' ; import { ExtraOptions , RouterModule , Routes } from '@angular/router' ; import { PreloadSelectedModulesOnly } from './core' ; import { ErrorComponent } from './error/error.component' ; import { LayoutComponent } from './layout/layout.component' ; import { HomeComponent } from './home/home.component' ; export const routes = [ { path : '' , component : LayoutComponent , children : [ { path : '' , component : HomeComponent , pathMatch : 'full' } ] } , { path : '**' , component : ErrorComponent } ] ; export const config = { preloadingStrategy : PreloadSelectedModulesOnly , useHash : true } ; @ NgModule ( { imports : [ RouterModule . forRoot ( routes , config ) ] , exports : [ RouterModule ] } ) export class AppRoutingModule { }