我正在将一个组件加载到另一个组件中。从任何其他路由路由到父组件时,如何刷新子组件中的数据。
我使用this.router.navigateByUrl(....Parent component route URL......
)刷新父组件上的数据,但子组件数据不刷新。
我已经尝试过this.ngOnInit();在this.router.navigateByUrl之后可以工作,但是效率不是很高。
我已经尝试过了:
let currentUrl = this.router.url;
this.router.navigateByUrl('/', { skipLocationChange: true }).then(() => {
this.router.navigate([currentUrl]);
,但这不会导航到新页面。有什么建议吗?