Reputation: 63
Is there a way to get an item value using getRawValue() for FormArrays in Angular.
I have the code using at(i).value
returning the value of the object at index "i".
var itemValue = (<FormArray>this.myForm.get('myList')).at(i).value;
As per @eper's answer in the post How to get values from disabled form controls in a form group?
I accessed the raw value of the form array with the code below:
var itemRawValue = (<FormArray>this.myForm.getRawValue().mylist);
How can I get the raw value of the item at index "i"?
Thanks.
Upvotes: 1
Views: 3971
Reputation: 304
itemsRawValue is already an array. You can access the object using below code.
const index = 0;
var itemsRawValue = (<FormArray>this.myForm.getRawValue().mylist)[index];
Upvotes: 2