I am seeking guidance on how to prevent changing the values of already selected values in other rows when each row of the formArray is altered. Adding controls dynamically and correctly retrieving values in filters are functioning properly. The issue arises when altering a row, causing changes in other dropdowns as well. Your assistance is greatly appreciated.
Currently, I have successfully implemented a FormArray where controls are dynamically added with the click of a button. These controls consist of two dropdowns, with the second dropdown's value dependent on the selection made in the first dropdown.
However, upon adding a new dynamic control and modifying the second dropdown's value, it also resets the value of previously selected values in the other dropdowns. The dropdowns are being rendered using material <mat-select>
.
Here is a snippet of my HTML:
<!-- HTML code here -->
The method onAddCars()
is responsible for adding new controls to the allocationsArray.
In my TypeScript file, the filterCarModel
method is used to filter the second control values based on the selected value in the first row of the allocationsArray. Here is an example:
<!-- TypeScript code here -->
If you could provide insight into how to ensure that each row of the formArray does not alter the values of already selected values in other rows, I would greatly appreciate it. Thank you.