import { NgModule } from '@angular/core' ; import { Routes , RouterModule } from '@angular/router' ; import { LoginComponent } from './login/login.component' ; import { AuthGuardService } from './core/auth-guard.service' ; const routes = [ { path : '' , redirectTo : 'login' , pathMatch : 'full' } , { path : 'todo' , redirectTo : 'todo/ALL' , canLoad : [ AuthGuardService ] } , { path : 'playground' , loadChildren : 'app/playground/playground.module#PlaygroundModule' , } ] ; @ NgModule ( { imports : [ RouterModule . forRoot ( routes ) ] , exports : [ RouterModule ] } ) export class AppRoutingModule { }