angular - 如何在 Angular 2 中重新加载相同 URL 的组件?

标签 angular typescript frontend angular2-routing angular2-services

我正在尝试使用 router.navigate 在 Angular 2 中重新加载相同的 url,但它不起作用。 网址:http://localhost:3000/landing 场景:我在 http://localhost:3000/landing现在我正在更改页面中的一个特定参数,它应该重新加载页面。

代码:

let link = ['Landing'];
this.router.navigate(link);

最佳答案

导航到某个虚拟组件,然后导航到您要重新加载的组件。 //第二个参数_skipLocationChange=true 避免后退按钮中出现该url

this.router.navigateByUrl('/DummyComponent', true);
this.router.navigate(["Landing"]);

关于angular - 如何在 Angular 2 中重新加载相同 URL 的组件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39396075/

相关文章:

javascript - Angular http 服务循环

angular - 当 child 处于事件状态时如何使父状态处于事件状态(即添加事件类)

javascript - 如何将 Nedb 与 Electron 集成

javascript - 键值对的双数据绑定(bind)对象,用于下拉列表

javascript - 从 Todo 应用程序元素中删除元素

javascript - Angular 4 使用 Guard 进行条件显示

javascript - 如何减少重复行?

typescript - 如何将属性函数的返回类型推断为属性的类型?

javascript - HTML 文本框输入模式 0000000-0000

javascript - 在 LODASH 中,断言对象或数组中存在键的最佳方法是什么?