40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { NgModule } from '@angular/core';
|
|
/* 引入路由模块 */
|
|
import { RouterModule, Routes } from '@angular/router';
|
|
|
|
/* 引入预加载策略 */
|
|
import { SelectivePreloadingStrategy } from './preloading-strategy';
|
|
|
|
/* 引入路由权限控制 */
|
|
import {LoginAuthService} from './services/login-auth.service'
|
|
|
|
|
|
/* 定义路由 */
|
|
const appRoutes: Routes = [
|
|
{ path: '', redirectTo: '/login', pathMatch: 'full' },
|
|
{
|
|
path: 'login',
|
|
loadChildren: './login/login.module#LoginModule',
|
|
canActivate:[LoginAuthService],
|
|
},
|
|
{
|
|
path: 'register',
|
|
loadChildren: './register/register.module#RegisterModule',
|
|
// data: { preload: false }
|
|
},
|
|
{
|
|
path: 'app',
|
|
loadChildren: './pages/pages.module#PagesModule',
|
|
canActivate:[LoginAuthService],
|
|
data: { preload: false }
|
|
}
|
|
]
|
|
|
|
@NgModule({
|
|
imports: [RouterModule.forRoot(appRoutes, { preloadingStrategy: SelectivePreloadingStrategy, useHash: true })],
|
|
exports: [
|
|
RouterModule
|
|
]
|
|
})
|
|
|
|
export class AppRoutingModule { } |