我知道我可以做到这一点
this.router.navigate(["/user-reviews"], username, userId, {skipLocationChange: true})
如果我来自
http://localhost:4200/main
并使用skipLocationChange,但我想说的是 http://localhost:4200/user-reviews/bob
我该怎么做才能只隐藏 userId 参数,而不隐藏用户名,并且仍然保留新路径user-reviews
而不是main
?这可能吗?我感谢任何帮助!
基于这篇文章
你可以很容易地做类似的事情
ngOnInit()
{
this.location.replaceState("/user-reviews/something");
}
location
在navigate
组件内部使用after应该可以解决问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句