I have a nested form similar to the following:
profileForm = new FormGroup({
firstName: new FormControl(''),
lastName: new FormControl(''),
address: new FormGroup({
street: new FormControl(''),
city: new FormControl(''),
date1: new FormControl(''),
date2: new FormControl('')
})
});
I'm trying to set the date2 mindate as date1 value like this:
<mat-form-field class="datepickerformfield" floatLabel="never">
<input matInput class="dp" formControlName="date2" [min]="profileform.controls['date1'].value" [matDatepicker]="date2" placeholder="DD/MM/AAAA" >
</mat-form-field>
Also tried with:
[min]="profileform.address.controls['date1'].value"
And
[min]="profileform.controls[address].controls['date1'].value"
But I get an error:
Cannot read property 'value' of undefined
How can I get the date1 value with the profileform object?
profileForm.get('address').get('date1')[min]="profileform.get('address').get('date1').value", or[min]="profileform.get('address.date1').value"