动态更改组件,但在地址栏上显示相同的URL [英] Dynamically change components but have same url displayed on address bar
问题描述
我有一个路由器插座,可以在表格,图表,列表等各种组件之间切换.
I have a router outlet that would toggle between various components like table, chart, list etc.
我要求不要在地址栏上显示网址更改.
I have a requirement to not show url change on the address bar.
假设表路径为 http://mysite/table ,而图表为 http://mysite ,而不显示相对路径更改.
Suppose if table path is http://mysite/table and chart is http://mysite/chart, it should always show http://mysite without displaying relative path change.
我认为拥有相同的网址没有任何意义,但想使用路由器插座.寻找任何想法来使用角度更改组件. (即使没有路由器也可以)
I think it doesn't make sense to have same url but wants to use a router outlet. Looking for any ideas to achieve that using angular to change components. (even without router is okay)
推荐答案
按此处所述使用skipLocationChange
https://angular.io/api/router/NavigationExtras
这篇关于动态更改组件,但在地址栏上显示相同的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!