import { NgModule } from '@angular/core' ; import { Routes , RouterModule } from '@angular/router' ; import { ChatComponent } from './chat/chat.component' ; import { AuthGuard } from './auth-guard.service' ; const routes = [ { path : 'chat' , component : ChatComponent , canActivate : [ AuthGuard ] } ] ; @ NgModule ( { imports : [ RouterModule . forChild ( routes ) ] , exports : [ RouterModule ] } ) export class ChatAppRoutingModule { }