3
我要清除瀏覽器導航歷史angular2讓用戶獲取後導航到特定頁面(我的興趣)的不應該能夠通過點擊瀏覽器後退或下一個按鈕返回或前進...... 。如何在angular2中重置瀏覽器的導航歷史記錄?
現在我試圖導入Angular2位置這樣
import {Location} from "angular2/router";
,並使用它像這樣以防止導航
this._location.replaceState('/'); //clear browser navigation history and reset it to root/
this._router.navigateByUrl('/home');
注:假設位置和路由器有正確注射
但它不工作。
感謝...我意識到我已被注入窗口對象和實施window.onpopstate事件...感謝會做後者實現自己的自定義HistoryStrategy ... – Jorin