app-routing.module.ts 982 Bytes
Newer Older
1
2
3
4
5
6
7
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { AuthGuard } from './shared/guards/auth.guard';

const routes: Routes = [
    { path: '', loadChildren: './layout/layout.module#LayoutModule', canActivate: [AuthGuard] },
8
9
10
    { path: 'login', loadChildren: './login/login.module#LoginModule', data: { language: navigator.language && (navigator.language.split('-')[0] == 'es' || navigator.language.split('-')[0] == 'en') ? navigator.language.split('-')[0] : 'es' }},
    { path: 'es/login', loadChildren: './login/login.module#LoginModule', data: { language: 'es' }},
    { path: 'en/login', loadChildren: './login/login.module#LoginModule', data: { language: 'en' }},
11
12
13
14
15
    { path: 'not-found', loadChildren: './not-found/not-found.module#NotFoundModule' },
    { path: '**', redirectTo: 'not-found' }
];

@NgModule({
16
    imports: [RouterModule.forRoot(routes)],
17
18
19
    exports: [RouterModule]
})
export class AppRoutingModule { }