Having encountered this issue multiple times on Stack Overflow without any success, I am reaching out for help to identify what I might be doing wrong.
In my component :
ngOnInit() {
this.companyCreatForm = this._formBuilder.group({
name: [null, [Validators.required, Validators.minLength(5)]],
about: [null, [Validators.required]],
businessType: [null, [Validators.required]],
address: this._formBuilder.group({
street: [],
website: [null, [Validators.required]],
mobile: [null, [Validators.required]],
email: [null, [Validators.required]],
pageId: [null, [Validators.required]],
}),
});
The Form :
<form [formGroup]="companyCreatForm" (ngSubmit)="creat_company()" novalidate class="form-horizontal">
<div class="panel panel-default" *ngIf="generalPanel">
<div class="panel-heading">General Info</div>
<div class="panel-body">
<!-- form inputs and controls omitted for brevity -->
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">Contact Info</div>
<div class="panel-body">
<!-- more form inputs and controls omitted for brevity -->
</div>
</div>
</form>
Although everything seems correct in the setup, upon loading the page an error is encountered:
Cannot find control with name: 'website', 'street', 'mobile', 'email', 'pageId'
The complete error message from the browser console is shown below:
Error Details Here...