All files / src/app app-routing.module.ts

100% Statements 15/15
100% Branches 0/0
100% Functions 2/2
100% Lines 13/13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 451x 1x 1x   1x 1x 1x 1x 1x   1x                                                 1x     3x   3x     1x  
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Routes, RouterModule } from '@angular/router';
 
import { DashboardComponent } from './dashboard/dashboard.component';
import { AuthguardService } from './nav/authguard.service';
import { Error404PageComponent } from './nav/four-0-four/404-component';
import { TasksComponent } from './tasks/tasks.component';
import { RoutingHistory } from './nav/routing-history/routing-history.service';
 
export const appRoutes: Routes = [
  { path: '', redirectTo: 'dashboard',  pathMatch: 'full' },
  { path: 'dashboard', component: DashboardComponent },
  { path: 'tasks', canActivate: [AuthguardService], component: TasksComponent, data: { toastrPrompt: 'Team Tasks'} },
  { path: '404', component: Error404PageComponent },
  { path: 'user', loadChildren: 'app/user/user.module#UserModule' },
  { path: '**', redirectTo: '404',  pathMatch: 'full' }
];
 
@NgModule({
  imports: [
    CommonModule,
    RouterModule.forRoot(appRoutes),
  ],
  exports: [
    RouterModule
  ],
  declarations: [
    Error404PageComponent,
  ],
  providers: [
    AuthguardService,
    RoutingHistory
 ],
})
export class AppRoutingModule {
 
  constructor(
    private routingHistory: RoutingHistory
  ) {
    this.routingHistory.loadRouting();
  }
 
}