Bind the form in template using formGroup and formControlName.?
✅ Example:
this.profileForm = new FormGroup({
firstName: new FormControl('', Validators.required),
lastName: new FormControl(''),
email: new FormControl('', [Validators.required,
Validators.email])
});
<form [formGroup]="profileForm" (ngSubmit)="onSubmit()">
<input formControlName="firstName" />
<input formControlName="lastName" />
<input formControlName="email" />
<button type="submit">Submit</button>
</form>