this.router.navigate(['CurrentComponent', {id: this._id, param1: value}]);
上面的代码更新了当前网址的查询参数。更改URL后,组件再次加载。 如何防止重新加载组件并只更新查询参数?
答案 0 :(得分:1)
向您的组件添加方法routerCanReuse
并返回true
routerCanReuse(next: ComponentInstruction, prev: ComponentInstruction) { return true; }
另见CanReuse