Currently, I have an array of check boxes set up in the following manner:
<div *ngFor="let order of orders; let i = index">
<input type="checkbox" id="{{orders[i].name}}_i">{{orders[i].name}}
</div>
Let's say the check boxes are labeled as order1, order2, and so on.
My goal is to be able to change the status of these check boxes (check/unchecked) based on their IDs or through some other method, like this:
document.getElementById("order1").checked = true;
I have attempted this approach, but encountered errors and it did not work as expected.
During my research, I came across a potential solution using @ViewChild
. However, this would require me to predefine the IDs, whereas in my case, the ID can vary. Can you suggest an alternative mechanism for achieving this?