我正在使用[routerLink]导航路由器。但它并没有像预期的那样工作。点击链接后,URL被更改,但页面没有刷新。我的代码:
<a [routerLink]="'/list/contentpage'" [queryParams]="{ id: item.id }">{{ item.title }}</a>
zyfwsgd61#
这看起来像你可能已经在该路由的一个版本上了,但是更改了查询参数,数据没有刷新。另一个堆栈溢出Q/A正是这种情况。Angular routing doesn't refresh the page
constructor(private router: Router, private, private route: ActivatedRoute) { this.value = this.route.snapshot.params.id; // for first entry route.params.subscribe(val => { this.value = this.route.snapshot.params.id; // put the code to initialize the page }); }
1条答案
按热度按时间zyfwsgd61#
这看起来像你可能已经在该路由的一个版本上了,但是更改了查询参数,数据没有刷新。
另一个堆栈溢出Q/A正是这种情况。
Angular routing doesn't refresh the page