安裝完 angular cli後
我使用
ng new myproj
ng serve
會顯示正常 但伺服器是由angular cli建立,因為我想試著搬回自己的伺服器用,所以我用
ng build 之後 把dist資料夾內的檔案全部移到apache靜態伺服器下,但若是子網域的話,例如localhost/angular ,index.html內的js都會對不上正確的路徑,只有在localhost根目錄下才能運行,請問該如何修改才能在子目錄下也運行呢?
謝謝
CHORME console的錯誤訊息
http://localhost/vendor/es6-shim/es6-shim.js Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/vendor/systemjs/dist/system.src.js Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/vendor/zone.js/dist/zone.js Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/vendor/reflect-metadata/Reflect.js Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/vendor/systemjs/dist/system.src.js Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/vendor/zone.js/dist/zone.js Failed to load resource: the server responded with a status of 404 (Not Found) localhost/:19 Uncaught ReferenceError: System is not defined
安裝完 angular cli後 我使用 ng new myproj ng serve 會顯示正常 但伺服器是由angular cli建立,因為我想試著搬回自己的伺服器用,所以我用 ng build 之後 把dist資料夾內的檔案全部移到apache靜態伺服器下,但若是子網域的話,例如localhost/angular ,index.html內的js都會對不上正確的路徑,只有在localhost根目錄下才能運行,請問該如何修改才能在子目錄下也運行呢? 謝謝
CHORME console的錯誤訊息
http://localhost/vendor/es6-shim/es6-shim.js Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/vendor/systemjs/dist/system.src.js Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/vendor/zone.js/dist/zone.js Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/vendor/reflect-metadata/Reflect.js Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/vendor/systemjs/dist/system.src.js Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/vendor/zone.js/dist/zone.js Failed to load resource: the server responded with a status of 404 (Not Found) localhost/:19 Uncaught ReferenceError: System is not defined
index.html的原始碼 ` <!doctype html>