FAB*_*987 51 reload typescript angular2-routing angular
如何通过TypeScript在Angular上重新加载当前页面?
我不想更改URL参数,只是为了重新加载.
Ale*_*sky 123
从技术上讲,这可以通过window.location.reload()以下方式实现:
HTML:
<button (click)="refresh()">Refresh</button>
TS:
refresh(): void {
    window.location.reload();
}
更新:
这是一个基本的StackBlitz示例,显示了正在执行的刷新.请注意,window.location.reload()执行时会保留"/ hello"路径上的URL .
希望这有帮助!
| 归档时间: | 
 | 
| 查看次数: | 168244 次 | 
| 最近记录: |