Dynamically change components but have same url displayed on address bar

左心房为你撑大大i 提交于 2019-12-01 12:34:26

问题


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.

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)


回答1:


Use skipLocationChange as described here https://angular.io/api/router/NavigationExtras



来源:https://stackoverflow.com/questions/49034009/dynamically-change-components-but-have-same-url-displayed-on-address-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!