typescript Angular路由刷新URL,但页面没有刷新

ryoqjall  于 12个月前  发布在  TypeScript
关注(0)|答案(1)|浏览(154)

我正在使用[routerLink]导航路由器。但它并没有像预期的那样工作。点击链接后,URL被更改,但页面没有刷新。
我的代码:

<a [routerLink]="'/list/contentpage'" [queryParams]="{ id: item.id }">{{ item.title }}</a>
zyfwsgd6

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
   });

}

相关问题