The value I get on submitting a form group is
{
"name": "Sunil",
"age": "23"
}
What I want is
{
"name": "Sunil",
"age": 23
}
My form group is as follows in my .ts file
myForm : FormGroup;
this.myForm = this._formbuilder.group({
name: [''],
age: [null]
});
Convert it before sending it.
const value = { ...this.myForm.value, age: +this.myForm.value.age };
Or you can use an input of type number.
<input type="number" formControlName="age">