Skip to content

Commit

Permalink
perf(根模块): 根据页面布局调整跟路由,添加路由守卫
Browse files Browse the repository at this point in the history
  • Loading branch information
jiayisheji committed Nov 30, 2017
1 parent 55d8317 commit 724e330
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

const routes: Routes = [
{
path: '',
loadChildren: 'app/pages/pages.module#PagesModule'
}
];

@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
import { NgModule, Injectable } from '@angular/core';
import { Routes, RouterModule, CanActivate } from '@angular/router';
import { AuthGuard } from '@app/core';

const routes: Routes = [
{
path: '',
canActivate: [AuthGuard],
loadChildren: 'app/feature/layout/layout.module#LayoutModule'
},
{
path: 'user',
loadChildren: 'app/feature/user/user.module#UserModule'
},
{
path: '**',
redirectTo: '/exception/404',
}
];

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

0 comments on commit 724e330

Please sign in to comment.