![](/img/trans.png)
[英]I added In-Reply-To and References in my headers while sending Email through SendGrid, however it doesn't work
[英]My Angular web app is routing through buttons as expected, but when I type the page path in the url, routing doesn't work. While hosted on firebase
当我在我的本地主机上运行该程序时,我可以使用 url 浏览我的程序,但当它托管在 firebase 上时则不能。
例如)输入“www.localhost:4200/home”带我回家。
键入“www.localhost:4200/contact”将我带到联系页面。
但
当我在 firebase 上托管网站时,我只能直接访问它:“ www.portfoliotest.web.app ”并通过按钮进行路由,但当我键入“www.portfoliotest.web.app/home”或“www”时则不行.portfoliotest.web.app/contact”,但我收到“找不到页面”firebase 错误。
如何设置我的路由以便我可以通过 url 访问我的页面?
谢谢你。
您的路由不是您的问题:这是您设置 Firebase 的方式。
在您的firebase.json
中,您需要将所有 URL 重定向到index.html
:
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
这样,您的 Angular 路由优先于 static 文件服务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.