在本地主机上测试时一切正常:
http://localhost:4200/#/?referralId=1
url留在浏览器中,我可以访问我的参数。但当我将应用程序上传到服务器时我进入这个url:
https://www.betradating.com?referralId=1
浏览器自动刷新,丢失参数并显示:
https://www.betradating.com/#
我该如何解决这个问题?
http://localhost: 4200/#/?referralId = 1
它看起来像你正在使用HashLocationStrategy?
https://www.betradating.com?referralId=1你必须添加一个<base href>
元素到应用程序的index.html(pushState routing)
添加
<head>
<meta>...
<title>...
<base href="/">
结果是我需要url中的哈希字符才能工作:
https://www.betradating.com/#/?referralId=1