2015-08-24 33 views
0

我在IIS上託管了我的AngularJS應用程序。在IIS上創建SPA託管路由問題

但同時瀏覽網址它出來爲http://localhost/MyApp#/login 它應該是http://localhost/MyApp/#/login

  1. 爲什麼有區別嗎?

  2. 如何解決相同的問題?

同樣,頁面上的鏈接也顯示錯誤的網址。

<ul> 
    <li><a href="/#/MyPage1">My Page 1</a></li> 
    <li><a href="/#/MyPage2">My Page 2</a></li> 
    <li><a href="/#/MyPage3">My Page 3</a></li> 
</ul> 

點擊任何鏈接,使URL http://localhost/#/MyPage1但它應該是http://localhost/MyApp/#/MyPage1

請建議的解決方案。

回答

0

使用<base url="" />標籤,docs

<head> 
<base href="http://localhost/MyApp/"> 
</head> 
+0

不適合環節的工作 – Gaurav123