Некоторое значение свойства не привязано должным образом. Попробуйте этот код один раз.
Html:
<form [formGroup]="registerForm">
<div class="form-group">
<label for="firstName">firstName</label>
<input formControllerName="firstName" type="text" maxlength="255" class="form-control" formControlName="firstName" id="firstName" [ngClass]="{'is-invalid': firstName.invalid && firstName.dirty}"/>
<div class="invalid-feedback">
firstName is required
</div>
</div>
</form>
Код TS:
registerForm: FormGroup;
ngOnInit() {
this.registerForm = this.formBuilder.group({
firstName: [this.registerForm.firstName, Validators.compose([Validators.required, Validators.maxLength(255)])],
});
}
get firstName() { return this.registerForm.get('firstName'); }
var firsNameObtained = this.firstName.value;//on form submit