仅隐藏 URL 的一部分 - Angular

用户6680

我知道我可以做到这一点

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");
}

locationnavigate组件内部使用after应该可以解决问题。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章