Router Navigate does not call ngOnInit when same page

前端 未结 12 1054
时光取名叫无心
时光取名叫无心 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:39

    Create a different path for the same component in the routes array .

    const routes : Routes = [ { path : "app", component: MyComponent }, { path: "app-reload", component: MyComponent }];

    If the current URL is "app" then navigate using "app-reload" and vice versa.

提交回复
热议问题