Can anyone assist me in figuring out why I keep encountering this issue of falling?
An 'name' does not exist in type 'ValidatorFn | ValidatorFn[] | AbstractControlOptions', as object literals may only specify known properties.
export class AddContactFormComponent implements OnInit {
public isShowForm:boolean = false;
public addContactForm: FormGroup;
public showFrom(): void{
this.isShowForm = true;
}
ngOnInit(): void {
this.addContactForm = new FormGroup(controls: {
name: new FormControl(null,{validators:[Validators.required]}),
phone: new FormControl(null,{validators:[Validators.required]}),
})
}
}
<button class="add-contact" *ngIf="!isShowForm" (click)="showFrom()">Add new contact</button>
<form action="" *ngIf="isShowForm" [formGroup]="addContactForm">
<div class="form__body">
<div class="form__group">
<label for="">Name</label>
<input type="text" placeholder="name" formContralName="name">
</div>
<div class="form__group">
<label for="">Phone</label>
<input type="text" placeholder="Phone" formContralName="phone">
</div>
</div>
<div class="form__footer">
<button type="sumbit" class="submit">create contact</button>
</div>
</form>