Currently, my nested form is structured like this:
this.form = this.formBuilder.group({
user: this.formBuilder.group({
id: ['', Validators.required],
name: ['', Validators.required],
phone: ['', Validators.required]
})
})
Usually, I retrieve values like this:
let userID = this.Form.controls['id'].value;
let userName = this.Form.controls['name'].value;
let userPhone = this.Form.controls['phone'].value;
Since the formGroups are nested, I'm unsure how to access the nested values. I attempted:
let userName = this.Form.controls['user'].name;
Can someone provide the correct syntax for accessing a form control value in a nested formGroup? Thank you.