我知道我能做到
this.router.navigate(["/user-reviews"], username, userId, {skipLocationChange: true})url不会改变,如果我来自
http://localhost:4200/main
使用skipLocationChange,但我想让它说的是http://localhost:4200/user-reviews/bob
我如何做才能使它只隐藏userId参数,而不隐藏用户名,并且仍然保留新路径user-reviews而不是main?这个是可能的吗?感谢大家的帮助!
发布于 2020-04-26 02:42:32
你可以很容易地做一些像这样的事情
ngOnInit()
{
this.location.replaceState("/user-reviews/something");
}在您的组件中,在navigate之后使用location应该可以做到这一点。
https://stackoverflow.com/questions/61430399
复制相似问题