I have this form group inside the group i have another form group how can i add formControlName to inputs inside profile form group? fo example
<input formControlName="profile.company_name">
but it doesn't work
userForm = new FormGroup({
isActive: new FormControl(false),
firstName: new FormControl(),
lastName: new FormControl('',Validators.required),
login: new FormControl(),
userType: new FormControl(),
name: new FormControl(''),
emailAddress: new FormControl(),
reference: new FormControl(),
entity: new FormControl(),
type: new FormControl(''),
profile: new FormGroup({
company_name: new FormControl(),
address: new FormControl('', Validators.required),
zipCode: new FormControl('', Validators.required),
city: new FormControl('', Validators.required),
phoneMobile: new FormControl(),
defaultEntity: new FormControl(),
phone: new FormControl(),
gender: new FormControl(),
})
});
CodePudding user response:
<ng-container formGroupName="profile"> <input formControlName="company_name" > </ng-container>