Router Navigate does not call ngOnInit when same page

前端 未结 12 1021
时光取名叫无心
时光取名叫无心 2020-11-28 03:20

I am calling router.navigate on same page with some query string parameters. In this case, ngOnInit() does not call. Is it by default or do I need

12条回答
  •  难免孤独
    2020-11-28 03:33

    On your navigation method,

    this.router.routeReuseStrategy.shouldReuseRoute = () => false;
    this.router.onSameUrlNavigation = 'reload';
    this.router.navigate(['/document'], {queryParams: {"search": currentSearch}});
    

提交回复
热议问题