结构是
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'
}
]
}
login.routing
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和[]中分别调用了gotpwdComponent和resetpwdcomponent>
我在appmodule中叫loginmodule我的步骤有什么问题吗?
有人可以引导我吗?
结构是1 –登录组件1.1 –忘记密码组件1.2 –重置密码组件为此,我创建了名为“ login module”的模块,这是我的编码:app.routing {path:``,...] >
尝试这样:
[routerLink]="['login/forgotPassword']
当前您忘记的密码是/login/login/forgotPassword