You do not have to create to form group for this.
You have to pass parent form group to the child.
Create formgroup and formcontrol in parent component and pass fromcontrol and formgroup in child component using @input.
Whenever you will submit form you will get values from child component fields too.
Go through the below code
Parent Component
<form [formGroup]="operatorForm" #formElement>
<div class="inner">
<!-- <h6>Donation Collected</h6> Text only For Churches Panel -->
<app-date-filter
[fromDate]="fromDate"
[toDate]="toDate"
[dateForm]="operatorForm"
></app-date-filter>
<div>
<mat-form-field>
<mat-select
formControlName="status"
(selectionChange)="filterChange($event)"
placeholder="Filter Type"
>
<mat-option [value]="FILTER_TYPE.active"> Active </mat-option>
<mat-option [value]="FILTER_TYPE.blocked"> Blocked </mat-option>
<mat-option [value]="FILTER_TYPE.deleted"> Deleted </mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
<div class="btn-wrap filterBtns">
<button
mat-raised-button
(click)="reset()"
[disabled]="!operatorForm.dirty"
>
Reset
</button>
<button
(click)="filter()"
mat-raised-button
color="primary"
class="ml10 mat-filter-button"
[disabled]="!operatorForm.dirty"
>
Filter
</button>
</div>
</form>
parent.component.ts
this.operatorForm = this._fb.group({
fromDate: ['', []],
toDate: ['', []],
status: [null, []]
});
get fromDate():FormControl{
return this.operatorForm.controls['fromDate'] as FormControl
}
get toDate():FormControl{
return this.operatorForm.controls['toDate'] as FormControl
}
Child Component
@Input() fromDate: FormControl;
@Input() toDate: FormControl;
@Input() dateForm: FormGroup;
<div class="inner" [formGroup]="dateForm">
<label for="">Added On</label>
<div class="column">
<mat-form-field>
<input
matInput
readonly
[matDatepicker]="frompicker"
formControlName="fromDate"
placeholder="From"
/>
<mat-datepicker-toggle
matSuffix
[for]="frompicker"
></mat-datepicker-toggle>
<mat-datepicker #frompicker></mat-datepicker>
</mat-form-field>
</div>
<div class="column">
<mat-form-field>
<input
matInput
readonly
[matDatepicker]="topicker"
formControlName="toDate"
placeholder="To"
/>
<mat-datepicker-toggle matSuffix [for]="topicker"></mat-datepicker-toggle>
<mat-datepicker #topicker></mat-datepicker>
</mat-form-field>
</div>
</div>