Angular4 - 从页面历史堆栈中删除页面引用

Angular4 - Remove a page reference from pages history stack

在我的 angular 网络应用程序中,需要从 angular 页面历史堆栈中删除一个页面引用。例如:我现在从登录页面导航到仪表板页面应该从堆栈中删除登录页面引用。

我想你需要看看 https://angular.io/api/router/NavigationExtras#replaceUrl

您需要在导航到组件时传递 replaceUrl: true,根据文档:

Navigates while replacing the current state in history.

// Navigate to /view
this.router.navigate(['/view'], { replaceUrl: true });