import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { HomeComponent } from './control-panel/home/home.component'; import { AutomationComponent } from './control-panel/profile/automation/automation.component'; import { AuthGuard } from './_helpers/auth.guard'; import { NotFoundComponent } from './control-panel/not-found/not-found.component'; import { ProfileComponent } from './control-panel/profile/profile/profile.component'; import { EditProfileComponent } from './control-panel/profile/edit-profile/edit-profile.component'; import { EditAutomationComponent } from './control-panel/profile/automation/edit-automation/edit-automation.component'; import { DevicesComponent } from './control-panel/profile/devices/devices.component'; import { DashboardComponent } from './control-panel/profile/dashboard/dashboard.component'; import { BetComponent } from './control-panel/bet/bet.component'; const routes: Routes = [ { path : '', redirectTo: 'home', pathMatch: 'full'}, { path : 'home', component: HomeComponent }, { path: 'profile', canActivate: [AuthGuard], children: [ { path: '', component: ProfileComponent}, { path: ':profileId', children: [ { path: '', component: ProfileComponent}, { path: 'dashboard', component: DashboardComponent}, { path: 'edit', component: EditProfileComponent}, { path: 'automation', children: [ { path: '', component: AutomationComponent}, { path: ':configurationId', component: EditAutomationComponent} ]}, { path: 'devices', children: [ { path: '', component: DevicesComponent} ]}, { path: 'bet', children: [ { path: '', component: BetComponent} ]} ]} ] }, { path: '**', component: NotFoundComponent} ]; @NgModule({ imports: [ RouterModule.forRoot(routes) ], exports: [ RouterModule ] }) export class AppRoutingModule { }