I am facing an issue with my components setup. I have 3 components - 2 child components and 1 parent component. The parent component has a save button, and in order to get data from the child components in the parent component, I have implemented the following code:
<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);
}
When I click on the Save button, I am able to retrieve proper data from the basic-details
component in the parent component. However, for the verification-details
component, I am encountering an error. Both child components are using @Input() to receive data like this:
for basic component:
@Input() customerDetails: ICustomerDetailsData;
for verification component
@Input() customerDetailsForKyc;
Am I missing something here?