【发布时间】:2021-02-06 10:08:00
【问题描述】:
我在 Angular-9 应用程序中有 3 个组件,如下所示:
组件 1
<div>
// I have a button here with Click Event.
</div>
组件 2
<div>
// I have a Grid here.
</div>
In a class file I'm getting Data and Binding Grid using ngOnInit() method.
我在第三个组件中使用了两个组件,如下所示:
组件 3
<div id='third-component'>
<component-one></component-one>
<component-two></component-two>
</div>
我想在单击 Component1 中的按钮时刷新 Component2 数据。如何做到这一点?
【问题讨论】:
-
您可以在服务上使用
rxjs Observable。
标签: angular typescript components