Repository navigation
Expand file tree
/
Copy pathapp-routing.module.ts
More file actions
32 lines (30 loc) · 1.66 KB
/
Copy pathapp-routing.module.ts
File metadata and controls
32 lines (30 loc) · 1.66 KB
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
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { HomeComponent } from './home/home.component';
import { ProtectedComponent } from './protected/protected.component';
import { AngularFireAuthGuard, canActivate, isNotAnonymous } from '@angular/fire/auth-guard';
import { SecondaryComponent } from './secondary/secondary.component';
const routes: Routes = [
{ path: '', component: HomeComponent, outlet: 'primary', pathMatch: 'prefix' },
{ path: '', component: SecondaryComponent, outlet: 'secondary', pathMatch: 'prefix' },
{ path: '', component: SecondaryComponent, outlet: 'tertiary', pathMatch: 'prefix' },
{ path: 'protected', component: ProtectedComponent, canActivate: [AngularFireAuthGuard] },
{ path: 'lazy', loadChildren: () => import('./protected-lazy/protected-lazy.module').then(m => m.ProtectedLazyModule) },
{ path: 'protected-lazy',
loadChildren: () => import('./protected-lazy/protected-lazy.module').then(m => m.ProtectedLazyModule),
canActivate: [AngularFireAuthGuard] },
{ path: 'protected', component: ProtectedComponent, canActivate: [AngularFireAuthGuard], outlet: 'secondary' },
{ path: 'protected', component: ProtectedComponent, canActivate: [AngularFireAuthGuard], outlet: 'tertiary' },
{ path: 'protected-lazy',
loadChildren: () => import('./protected-lazy/protected-lazy.module').then(m => m.ProtectedLazyModule),
...canActivate(() => isNotAnonymous),
outlet: 'secondary' },
];
@NgModule({
imports: [RouterModule.forRoot(routes, {
initialNavigation: 'enabled',
relativeLinkResolution: 'legacy'
})],
exports: [RouterModule]
})
export class AppRoutingModule { }