Cannot create property 'validator' on string
I had a same issue and I was passing form
object as a value like formGroup="form"
but you need to bind the form
object using []
aroung as [formGroup]="form"
.
See the example below:
<form [formGroup]="form">
// form-controls
</form>
You're passing the form group name as a string rather than a reference to the formGroup and trying to typecast it as a FormGroup (group="addressFormGroup"
). group="addressFormGroup"
doesn't pass the formGroup object, it passes a string with the value of addressFormGroup
.