Advertisement
Guest User

app-routing.module.ts

a guest
Feb 27th, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. import { MessagesComponent } from './../messages/messages.component';
  2. import { TableComponent } from './../businesses/selected-b/table/table.component';
  3. import { SelectedBComponent } from './../businesses/selected-b/selected-b.component';
  4. import { AuthGuard } from './auth.guard';
  5. import { BusinessesComponent } from './../businesses/businesses.component';
  6. import { RegisterComponent } from '../register/register.component';
  7. import { LoginComponent } from '../login/login.component';
  8. import { NotFoundComponent } from '../not-found/not-found.component';
  9. import { HomeComponent } from '../home/home.component';
  10. import { NgModule } from '@angular/core';
  11. import { InfoComponent } from '../info/info.component';
  12. import { ProfileComponent } from '../profile/profile.component';
  13. import { RouterModule, Routes, PreloadAllModules } from '@angular/router';
  14. import { NotAuthGuard } from "./notAuth.guard";
  15. import { AdminComponent } from '../admin/admin.component';
  16.  
  17. const routes: Routes = [
  18. {path: '', component: HomeComponent},
  19. {path: 'info', component: InfoComponent},
  20. {path: 'home', redirectTo: '' },
  21. {path: 'profile', component: ProfileComponent, canActivate: [AuthGuard]},
  22. {path: 'not-found', component: NotFoundComponent},
  23. {path: 'login', component: LoginComponent, canActivate: [NotAuthGuard]},
  24. {path: 'allB', component: BusinessesComponent, canActivate: [AuthGuard]},
  25. {path: 'messages', component: MessagesComponent, canActivate: [AuthGuard]},
  26. {path: 'bTable', component: TableComponent, data:{preload: true}},
  27. {path: 'selectedB', component: SelectedBComponent, canActivate: [AuthGuard]},
  28. {path: 'register', component: RegisterComponent, canActivate: [NotAuthGuard]},
  29. {path: '**', redirectTo: 'not-found'}
  30. ];
  31.  
  32. @NgModule({
  33. imports: [RouterModule.forRoot(routes)],
  34. exports: [RouterModule],
  35. providers: []
  36. })
  37.  
  38. export class AppRoutingModule { }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement