import { NgModule } from '@angular/core' ; import { RouterModule , Routes } from '@angular/router' ; import { PreloadSelectedModuleStrategy } from '@app/preload-selected-module-strategy' ; const routes = [ { path : '' , redirectTo : 'home' , pathMatch : 'full' } , { path : 'home' , loadChildren : ( ) => import ( './home/home.module' ) . then ( m => m . HomeModule ) } , { path : 'about' , loadChildren : ( ) => import ( './about/about.module' ) . then ( m => m . AboutModule ) } , { path : 'prepare' , loadChildren : ( ) => import ( './prepare/prepare.module' ) . then ( m => m . PrepareModule ) } , { path : 'exam' , loadChildren : ( ) => import ( './exam/exam.module' ) . then ( m => m . ExamModule ) } , { path : '**' , redirectTo : 'home' } ] ; @ NgModule ( { imports : [ RouterModule . forRoot ( routes , { useHash : true , scrollPositionRestoration : 'enabled' , preloadingStrategy : PreloadSelectedModuleStrategy } ) ] , exports : [ RouterModule ] , providers : [ PreloadSelectedModuleStrategy ] } ) export class AppRoutingModule { }