I need assistance converting the content of my FormGroup value into an interface that will be used for sending data to my Web Api.
The interface I am using is defined as follows:
export interface MoneyItemI {
Description: string;
Amount: number;
}
This is how my submit method looks:
onSubmit() {
let jsonString = JSON.stringify(this.itemForm.value);
let mi = <MoneyItemI>JSON.parse(jsonString);
}
Upon inspection, I have observed that although an object is created with JSON.parse, it does not match the expected structure of MoneyItemI. For instance, the 'Amount' property appears to be treated as a string instead of a number.
How can I ensure that I create a valid interface based on the value of my FormGroup?