我的角度应用中有三个组件,A,B和C.A是主要组件,B是嵌套在A中的较小部分,C是模态对话框。
组件A的模板代码看起来……
你在组件-b中缺少@Input
应用组分-a.html
<app-component-b [data]="form-data"></app-component-b>
APP-组件b.ts
@Input() data; // Here will be the data
因此,关闭对话框并接收数据后,需要将其传递给组件-b。由于component-b是component-child,你需要在component-b中使用@Input装饰器。如果需要将数据传递给父组件(从组件-b到组件-a),将使用输出