我在Angular7中有一个简单的待办事项列表应用程序,我在其中添加了一个在“个人”和“工作”之间切换的按钮。下面是要切换的函数:
toggleShowPersonal(){
if (this.showPersonal){
this.showPersonal = false;
}
else {
this.showPersonal = true;
}
this.refreshTodos();
}
显示列表后,用户可以选择编辑或添加todo项。这将通过以下命令将它们带到详细信息页:
this.router.navigate(['todos',id]);
我正在尝试更改路由命令以添加“showPersonal”参数:
this.router.navigate(['todos',id, this.showPersonal]);
我已更新路由模块以反映更改:
{ path: 'todos/:id,:showPersonal', component: TodoComponent, canActivate:[RouteGuardService]},
但是,通过此更改,它不再进入详细信息页,而是默认进入登录页。
我做错什么了?