Angular Reactive form setValue setting string to number input type, input box empty but string value is assigned in controlls, validation required is not working
This is Form Controller
ngOnInit() {
this.profileForm = new FormGroup({
name: new FormControl("", Validators.required),
age: new FormControl("", Validators.required),
}
}
patchAge(){
this.profileForm.controls["age"].setValue("somethingString");
}
This is template
<form [formGroup]="profileForm" (ngSubmit)="onFormSubmit()">
<input
type="text"
formControlName="name"
/>
<input
type="number"
formControlName="age"
/>
</form>