![](/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.