init commit
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
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 { }
|
||||
Reference in New Issue
Block a user