{
"estimate_number": "2020-1234",
"brand": "PF",
"floor": "Laminaat",
"floor_type": "Normaal",
"plint_type": "Hoog",
"floor_installer": {
"id": "14",
"name": "Maestro"
},
"address": {
"street": "Straatnaam 19",
"city": "Amsterdam",
"postal_code": "1111AB",
"province": "Noord-Holland"
},
"notes": "Test note"
}
How come when I access
const city = this.addEventForm.get('address.city').value;
, it returns a value (in this case Amsterdam), but accessing const floorInstaller = this.addEventForm.get('floor_installer.id').value;
results in an error message in the developer console saying ERROR TypeError: Cannot read property 'value' of null at CalendarComponent.push..
This JSON object represents a reactive form in Angular.
The FormBuilder code used to create the form:
// FormBuilder
const datesGroup = this.fb.group({
start_date: '',
start_time: { hour: 7, minute: 30 },
end_date: '',
end_time: { hour: 17, minute: 30 },
});
const addressGroup = this.fb.group({
street: '',
city: '',
postal_code: '',
province: '',
});
this.addEventForm = this.fb.group({
event_dates: datesGroup,
estimate_number: '',
brand: '',
floor: '',
floor_type: '',
plint_type: '',
floor_installer: { id: '', name: '', },
address: addressGroup,
notes: '',
});