Files
airport-chengdu-web/src/app/app-routing.module.ts
T

41 lines
1.1 KiB
TypeScript
Raw Normal View History

2018-10-26 11:33:25 +08:00
import { NgModule } from '@angular/core';
/* 引入路由模块 */
import { RouterModule, Routes } from '@angular/router';
/* 引入预加载策略 */
import { SelectivePreloadingStrategy } from './preloading-strategy';
/* 引入路由权限控制 */
2018-12-03 11:28:24 +08:00
import { LoginAuthService } from './services/login-auth.service'
2018-10-26 11:33:25 +08:00
/* 定义路由 */
const appRoutes: Routes = [
{ path: '', redirectTo: '/login', pathMatch: 'full' },
{
path: 'login',
loadChildren: './login/login.module#LoginModule',
2018-12-03 11:28:24 +08:00
canActivate: [LoginAuthService],
data: { preload: false, reuse: false }
2018-10-26 11:33:25 +08:00
},
{
path: 'register',
loadChildren: './register/register.module#RegisterModule',
2018-12-03 11:28:24 +08:00
data: { preload: false, reuse: false }
2018-10-26 11:33:25 +08:00
},
{
path: 'app',
loadChildren: './pages/pages.module#PagesModule',
2018-12-03 11:28:24 +08:00
canActivate: [LoginAuthService],
data: { preload: false, reuse: true }
2018-10-26 11:33:25 +08:00
}
]
@NgModule({
imports: [RouterModule.forRoot(appRoutes, { preloadingStrategy: SelectivePreloadingStrategy, useHash: true })],
exports: [
RouterModule
]
})
export class AppRoutingModule { }