2014-01-19 135 views
0

從Tomcat /目錄移動我的Web項目之後到子文件夾/WebApp我得到一個錯誤GET http://localhost:8080/partials/view-worker-apps-used.html 404 (Not Found)Web服務器AngularJs GET找不到404

這是我的項目結構:

- WebApp 
    - partials 
    - view-worker-details.html 
    - view-worker-apps-used.html 
    - js 
    - controlers.js 
    - services.js 
    - index.html 
  1. 首先我負載http://localhost:8080/WebApp/#/screen2 這是view-worker-details.html被注入到index.html中$routeProvider
  2. 在載入的view-worker-details.html屏幕有

<div ng-include="/partials/view-worker-apps-used.html"></div>

我寧願不把Web應用程序前綴到的路徑NG-包括。 我該如何解決這個問題?

+0

將''添加到index.html的「」部分。 – Stewie

+0

添加 userbb

回答

0

您可以採取以下方法之一。

方法1:如果您確定您的contextpath不會更改,請在ng-include中使用以下路徑。

<div> 
    <div ng-include="/WebApp/#/screen2/partials/view-worker-apps-used.html"> </div> 
</div> 

注:刪除單引號;它不需要如此刪除它,以避免混淆

方法2:如果您認爲您的上下文名稱可能會在將來更改,那麼我會建議重新驗證以下文件的位置。 a。首先嚐試刪除多餘的單引號 b。使用以下URL驗證view-worker-apps-used.html文件的位置

/WebApp/#/screen2/partials/view-worker-apps-used.html 

c。驗證您在其中添加了以下代碼行的文件的位置,並確保您用作「partials/view-worker-apps-used.html」的相對路徑是有效的。

<div> 
    <div ng-include="'partials/view-worker-apps-used.html'"> </div> 
</div> 

我希望它可以幫助。