0
我正在使用angularjs
,而我正在使用html5Mode
。html5Mode中的Angularjs鏈接問題
在使用html5Mode
之前,鏈接同時在同一頁和新標籤頁中工作。鏈接如下:
http://localhost:81/vahidnajafi/#/about
但在html5Mode,它只能在同一頁上,但是當我在新標籤中打開它,它去404 Not found
頁。
http://localhost:81/vahidnajafi/about
感謝。
你正在使用什麼類型的網絡服務器? – molson504x
'html5Mode'是單頁面應用程序,所以它期望應用程序是一個單一的頁面。它按預期工作,並在[文檔](https://docs.angularjs.org/guide/$location)中描述。 – GillesC
本質上,請確保您在快速應用中引用角度應用的主目錄: app.use(express.static(path.join(__ dirname,'app_client'))); (函數(req,res){ res.sendfile(path.join(__ dirname,'app_client','index.html')) }); 並確保您的templateUrl路由屬性以/開頭,因此它知道從根目錄引用模板的位置,而不是當前目錄。 – awimley