import { NgModule } from '@angular/core' ; import { Routes , RouterModule , PreloadAllModules } from '@angular/router' ; import { LoginComponent } from './auth/login.component' ; import { AuthGuard } from './auth/guards/auth.guard' ; const routes = [ { path : 'connect' , data : { view : 'embedded' } , loadChildren : ( ) => import ( './connect/connect.module' ) . then ( m => m . ConnectModule ) } , { path : 'auth' , data : { view : 'embedded' } , component : LoginComponent } , { path : '' , canActivate : [ AuthGuard ] , canActivateChild : [ AuthGuard ] , loadChildren : ( ) => import ( './main/main.module' ) . then ( m => m . MainModule ) } , { path : '**' , redirectTo : 'error/404' } ] ; @ NgModule ( { imports : [ RouterModule . forRoot ( routes , { preloadingStrategy : PreloadAllModules , enableTracing : false } ) ] , exports : [ RouterModule ] } ) export class AppRoutingModule { }