Hey everybody. I have a form group for the information of a transaction and I want to get the individual field values of the form to save it.
When I check the logs it shows that the data from the form is being fetched without problems:
amount: "420444"
destination: "DE36584fh9"
recipient: "John Johnso545n"
reference: "Testerinoadfhg"
however, I want to be able to access the individual values of the form instead of the whole form as an object because I have a function that takes several arguments so what I want to do is to have individual values for
amount, destination, etc.
this is my form:
this.transactionForm = formBuilder.group({
recipient: [''],
destination: [''],
amount: [0.01],
type: ['now'],
reference: [''],
date: [new Date().toISOString().split('T')[0]]
});
and this is what I tried to do to save the information:
this.templateServicerino.createTemplate(this.transactionForm.controls['destination'], this.transactionForm.controls['recipient'], this.transactionForm.controls['amount'], this.transactionForm.controls['reference'] );
when that didn’t work I tried a single value just to check:
let referencerino: string;
referencerino = this.transactionForm.controls['reference'];
and the IDE shows the error : TS2322: Type ‘AbstractControl’ is not assignable to type ‘string’.
Thank you in advance for your help