【发布时间】:2020-01-10 12:51:51
【问题描述】:
结构是
1--login component
1.1--forget password component
1.2--reset password component
为此,我创建了名为“登录模块”的模块
这是我的代码:
app.routing
{
path: '',
redirectTo: 'login',
pathMatch: 'full',
},
{
path: 'login',
component: LoginComponent,
children: [
{
path: 'login',
canActivate: [AuthServiceGuard],
loadChildren: './login/login.module#LoginModule'
}
]
}
登录.路由
const routes: Routes = [
{
path:'',
component : LoginComponent,
data:{
title:'login'
},
children:[{
path:'forgotPassword',
component:forgotPwdComponent,
data:{
title:'ForgotPassword'
}
},
{
path:'resetPassword',
component:ResetPwdComponent,
data:{
title:'ResettPassword'
}
}]
在 login.html 中我使用 routerLink 作为,
<a class="achortag" routerLink="/forgotPassword">Forgot Password</a>
现在出现如下错误:
core.js:1673 ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'forgotPassword'
Error: Cannot match any routes. URL Segment: 'forgotPassword'
我在 loginmodule 和中调用了 forgetpwdComponent 和 resetpwdcomponent
我在 appmodule 中调用了 loginmodule 我的步骤有什么问题吗?
有人可以指导我吗??
【问题讨论】:
标签: angular angular6 angular7 lazy-loading angular8