【发布时间】:2019-07-30 08:03:50
【问题描述】:
我在 Angular 7 中有一个简单的待办事项列表应用程序,我在其中添加了一个在“个人”和“工作”之间切换的按钮。这是切换的功能:
toggleShowPersonal(){
if (this.showPersonal){
this.showPersonal = false;
}
else {
this.showPersonal = true;
}
this.refreshTodos();
}
一旦列表出现,用户可以选择编辑或添加待办事项。这将通过以下命令将他们带到详细信息页面:
this.router.navigate(['todos',id]);
我正在尝试更改路由命令以添加“showPersonal”参数:
this.router.navigate(['todos',id, this.showPersonal]);
我已更新路由模块以反映更改:
{ path: 'todos/:id,:showPersonal', component: TodoComponent, canActivate:[RouteGuardService]},
但是,通过此更改,它不再转到详细信息页面,而是默认为登录页面。
我做错了什么?
【问题讨论】: