import { NgModule } from '@angular/core' ; import { RouterModule , Routes } from '@angular/router' ; import { AppComponent } from './app.component' ; import { HomeComponent } from './pages/home/home.component' ; import { SignupComponent } from './pages/signup/signup.component' ; import { LoginComponent } from './pages/login/login.component' ; import { LogoutComponent } from './pages/logout/logout.component' ; import { AccountComponent } from './pages/account/account.component' ; import { AdminComponent } from './pages/admin/admin.component' ; import { NotFoundComponent } from './pages/not-found/not-found.component' ; import { AuthGuardLogin } from './services/auth-guard-login.service' ; import { AuthGuardAdmin } from './services/auth-guard-admin.service' ; const routes = [ { path : '' , component : HomeComponent } , { path : 'signup' , component : SignupComponent } , { path : 'login' , component : LoginComponent } , { path : 'logout' , component : LogoutComponent } , { path : 'account' , component : AccountComponent , canActivate : [ AuthGuardLogin ] } , { path : 'admin' , component : AdminComponent , canActivate : [ AuthGuardAdmin ] } , { path : 'notfound' , component : NotFoundComponent } , { path : '**' , redirectTo : '/notfound' } , ] ; @ NgModule ( { imports : [ RouterModule . forRoot ( routes ) ] , exports : [ RouterModule ] } ) export class RoutingModule { }