import { NgModule } from '@angular/core' ; import { Routes , RouterModule } from '@angular/router' ; import { DashboardComponent } from './dashboard/dashboard.component' ; import { PageNotFoundComponent } from './page-not-found.component' ; const routes = [ { path : '' , pathMatch : 'full' , redirectTo : 'dashboard' , } , { path : 'dashboard' , component : DashboardComponent } , { path : 'characters' , loadChildren : 'app/characters/characters.module#CharactersModule' } , { path : 'planets' , loadChildren : 'app/planets/planets.module#PlanetsModule' } , { path : '**' , pathMatch : 'full' , component : PageNotFoundComponent } , ] ; @ NgModule ( { imports : [ RouterModule . forRoot ( routes ) ] , exports : [ RouterModule ] } ) export class AppRoutingModule { }