【发布时间】:2018-01-10 22:58:32
【问题描述】:
我正在使用 angular2 路由。当用户在搜索字段中重新输入值并点击搜索时,需要重新加载相同的组件,但路由参数不同。
<button (click)="onReload()">Search</button>
onReload() {
this.router.navigate(['results',this.location]);
}
这是我的 ResultsComponent 的路由路径
{ path:'results/:location', component:ResultsComponent}
此函数更改 URL,但不会重新初始化组件。
在angularjs,ui-router我可以这样实现。
$state.go($state.current, location, {reload: true});
如何在 angular4 中做到这一点?
【问题讨论】:
-
我们有同样的问题:(
-
@vistajess 如果您找到解决方案,请告诉我。
标签: angular angular-routing angular-router