@@ -3,23 +3,39 @@ import { Routes, RouterModule, RouteReuseStrategy, DetachedRouteHandle, Activate
33import { AppComponent } from './app.component' ;
44
55import { HomeComponent } from './home/home/home.component' ;
6+ import { PersonAddComponent } from './base-data/person-add/person-add.component' ;
7+ import { PersonEditComponent } from './base-data/person-edit/person-edit.component' ;
8+ import { PersonListComponent } from './base-data/person-list/person-list.component' ;
69import { UserLoginComponent } from './user/user-login/user-login.component' ;
710import { UserRegisterComponent } from './user/user-register/user-register.component' ;
811import { UserForgetpwdComponent } from './user/user-forgetpwd/user-forgetpwd.component' ;
912import { UserInfoComponent } from './user/user-info/user-info.component' ;
1013import { UserChangePwdComponent } from './user/user-change-pwd/user-change-pwd.component' ;
1114import { UserService } from './user/user.service' ;
1215
16+ import { AppCkeditorComponent } from './share/app-ckeditor/app-ckeditor.component' ;
17+ import { AppChartsComponent } from './share/app-charts/app-charts.component' ;
18+ import { AmapDemoComponent } from './share/app-amap/amap-demo.component' ;
19+ import { CalendarDemoComponent } from './share/app-calendar/calendar-demo.component' ;
20+
1321
1422const appRoutes : Routes = [
1523 {
1624 path : 'home' ,
1725 component : HomeComponent ,
18- canActivate : [ UserService ]
26+ // canActivate: [UserService]
27+ } ,
28+ {
29+ path : 'person-list' ,
30+ component : PersonListComponent
31+ } ,
32+ {
33+ path : 'person-add' ,
34+ component : PersonAddComponent
1935 } ,
2036 {
21- path : 'base-data ' ,
22- loadChildren : './base-data/base-data.module#BaseDataModule'
37+ path : 'person-edit/:id ' ,
38+ component : PersonEditComponent
2339 } ,
2440 {
2541 path : 'user-register' ,
@@ -44,6 +60,22 @@ const appRoutes: Routes = [
4460 path : 'user-change-pwd' ,
4561 component : UserChangePwdComponent
4662 } ,
63+ {
64+ path : 'charts' ,
65+ component : AppChartsComponent
66+ } ,
67+ {
68+ path : 'ckeditor' ,
69+ component : AppCkeditorComponent
70+ } ,
71+ {
72+ path : 'amap' ,
73+ component : AmapDemoComponent
74+ } ,
75+ {
76+ path : 'calendar' ,
77+ component : CalendarDemoComponent
78+ } ,
4779 {
4880 path : '' ,
4981 redirectTo : '/home' ,
@@ -97,6 +129,9 @@ export class CustomReuseStrategy implements RouteReuseStrategy {
97129 }
98130 // 决定是否重用路由
99131 shouldReuseRoute ( future : ActivatedRouteSnapshot , curr : ActivatedRouteSnapshot ) : boolean {
132+ if ( future . params . reuse === 'false' ) {
133+ return false ;
134+ }
100135 // 在此处可以取得跳转前和跳转后的路由路径
101136 // console.log('CustomReuseStrategy:shouldReuseRoute', future, curr);
102137 return future . routeConfig === curr . routeConfig ;
0 commit comments