I have 3 components, 2 child and 1 parent.
I have save button in parent component, for getting child data in parent, I have tried this:
<div class="border border-dark p-1 m-1">
<basic-details
*ngIf="customerData"
[formType]="formType"
[customerDetails]="customerData"
#customerDetails
></basic-details>
</div>
<div class="border border-dark p-1 m-1">
<verification-details
*ngIf="customerData"
[formType]="formType"
[customerDetailsForKyc]="customerData"
#customerDetailsForKyc
></verification-details>
</div>
<div class="row main justify-content-center">
<button class="btn btn-primary" (click)="save(customerDetails, customerDetailsForKyc)">Save</button>
<button class="btn btn-primary ml-2" (click)="cancel()">Cancel</button>
</div>
ts file
save(basic, kyc) {
console.log('basic', basic);
console.log('kyc', kyc);
}
For basic-details
component, I am getting proper data in my parent component in save button click, but for verification-details
I am getting following error:
In both child component I am getting data using @Input() like this:
for basic component:
@Input() customerDetails: ICustomerDetailsData;
for verification component
@Input() customerDetailsForKyc;
Is something I am doing wrong?
question from:
https://stackoverflow.com/questions/66062469/how-to-pass-child-component-data-into-parent 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…