我的home.routing.module.ts
上有以下路线:
const routes: Routes = [
{ path: '', component: HomeComponent, canActivate: [AnonymousGuard] },
{ path: 'press', component: PressComponent, canActivate: [AnonymousGuard] },
{ path: 'legal', component: LegalComponent, canActivate: [AnonymousGuard] },
{ path: 'contact', component: ContactComponent, canActivate: [AnonymousGuard] },
{ path: 'invite/:id', component: InviteComponent, canActivate: [AnonymousGuard] },
{ path: 'login', loadChildren: '../auth/auth.module#AuthModule' },
// this doesn't work, it takes me to "login"
{ path: 'register', loadChildren: '../auth/auth.module#AuthModule' },
{ path: '**', redirectTo: '', pathMatch: 'full' }
];
我的auth.routing.module.ts
上有以下路线:
const routes: Routes = [
{ path: '', component: LoginComponent, canActivate: [AnonymousGuard] },
{ path: 'login', component: LoginComponent, canActivate: [AnonymousGuard] },
{ path: 'forgot-password', component: ForgotPasswordComponent, canActivate: [AnonymousGuard] },
// this works if if I type in "/login/register"
{ path: 'register', component: RegisterComponent, canActivate: [AnonymousGuard] },
{ path: 'verify-email', component: VerifyEmailComponent, canActivate: [AnonymousGuard] },
{ path: '**', redirectTo: '', pathMatch: 'full' }
];
我想让register
可以访问register
,而不是从家庭路由模块访问login/register
,我该怎么做?