我最近升級到了Angular2最終版本。我不認爲這是重複的,因爲HashLocationStrategy在Angular2 Final/RC7更新後停止工作。以前,刷新頁面會使用散列(#)獲取/獲取相關路由並重新加載頁面。現在,我得到任何刷新頁面上此錯誤:Angular2 Final:頁面刷新錯誤,'無法GET'路線。 HashLocationStrategy失敗
我相信這一切,因爲它試圖加載http://localhost:3000/main/home
而不是http://localhost:3000/#/main/home
。
任何想法爲什麼HashLocationStrategy
停止工作?我應該在我的@NgModule
中輸入HashLocationStrategy
嗎?
的可能的複製http://stackoverflow.com/questions/38265536/angular-2-rc-4-hashlocationstrategy-no-longer-working – Supamiu
https://angular.io/docs/ts/latest/guide/router.html#!# -hashlocationstrategy-這是你需要的一切。 – Supamiu