import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { AwardeeListComponent } from "./awardee-list/awardee-list.component"; import { JudgeListComponent } from "./judge-list/judge-list.component"; import { AwardeeEditorComponent } from "./awardee-editor/awardee-editor.component"; import { JudgeEditorComponent } from "./judge-editor/judge-editor.component"; import { JudgeService } from "./shared/judge.service"; import { JudgeResolverService } from "./shared/judge-resolver.service"; import { AwardeeService } from "./shared/awardee.service"; import { AwardeeResolverService } from "./shared/awardee-resolver.service"; import { YearResolverService } from "./shared/year-resolver.service"; import { AuthGuardService } from "./auth/auth-guard.service"; const routes: Routes = [ { path: 'awardees', component: AwardeeListComponent, resolve: { awardees: AwardeeService, }, canActivate: [AuthGuardService], }, { path: 'awardee/new', component: AwardeeEditorComponent, resolve: { years: YearResolverService, }, canActivate: [AuthGuardService], }, { path: 'awardee/edit/:id', component: AwardeeEditorComponent, resolve: { awardee: AwardeeResolverService, years: YearResolverService, }, canActivate: [AuthGuardService], }, { path: 'judges', component: JudgeListComponent, resolve: { judges: JudgeService, }, canActivate: [AuthGuardService], }, { path: 'judge/new', component: JudgeEditorComponent, canActivate: [AuthGuardService], }, { path: 'judge/edit/:id', component: JudgeEditorComponent, resolve: { judge: JudgeResolverService, }, canActivate: [AuthGuardService], }, { path: '', redirectTo: '/awardees', pathMatch: 'full', canActivate: [AuthGuardService] }, // {path: '**', component: PageNotFoundComponent}, ]; @NgModule({ imports: [RouterModule.forRoot(routes)], exports: [RouterModule] }) export class AppRoutingModule { }