My task is to create a set of three checkboxes with specific conditions when clicked.
For instance, consider checkboxes 1, 2, and 3.
If checkbox 1 is selected, then checkboxes 2 and 3 should be enabled.
If checkbox 1 is changed to 'false', then checkboxes 2 and 3 need to be disabled.
Additionally, if checkbox 1 is unchecked, the values of checkboxes 2 and 3 should be reset to 'false' and they should be disabled.
I have managed to achieve the above conditions. However, the issue lies in the fact that the value is not updating in ngmodel.
Sample code snippet:
<td>
<div class="col-lg-12" id="radiobutton">
<input #EDIsRead=ngModel [(ngModel)]="GetRoleIsRead.EDIsRead" name="GetRoleIsRead.EDIsRead" class="form-check-input col-sm-2"
type="checkbox" id="EDIsRead" style="padding-left: 0px !important;" (change)="CheckeventforRead('ED')">
</div>
</td>
<td>
<div class="col-lg-12" id="radiobutton">
<input #EDIsModifyLOB=ngModel [(ngModel)]="GetRoleIsModifyLOB.EDIsModifyLOB" name="GetRoleIsModifyLOB.EDIsModifyLOB" class="form-check-input col-sm-2"
type="checkbox" id="EDIsModifyLOB" style="padding-left: 0px !important;" (change)="CheckeventforModifyLOB('ED','0')">
</div>
</td>
<td>
<div class="col-lg-12" id="radiobutton">
<input #EDIsModifyAll=ngModel [(ngModel)]="GetRoleIsModifyAll.EDIsModifyAll" name="GetRoleIsModifyAll.EDIsModifyAll" class="form-check-input col-sm-2"
type="checkbox" id="EDIsModifyAll" style="padding-left: 0px !important;" (change)="CheckeventforModifyAll('ED','0')">
</div>
</td>
Input parameters given are 'true true false'.
So, I am passing 'true' for checkbox 1, 'true' for checkbox 2, and 'false' for checkbox 3 with two-way binding.
If I change checkbox 3 to 'true', then checkbox 2 becomes unchecked but the value does not change.
Here is an example of my JSON data.
Before:
{"GetRoleIsRead.EDIsRead": true, "GetRoleIsModifyLOB.EDIsModifyLOB": false, "GetRoleIsModifyAll.EDIsModifyAll": true }
After checking the second checkbox:
{"GetRoleIsRead.EDIsRead": true, "GetRoleIsModifyLOB.EDIsModifyLOB": true, "GetRoleIsModifyAll.EDIsModifyAll": true }
The expected output should be:
{"GetRoleIsRead.EDIsRead": true, "GetRoleIsModifyLOB.EDIsModifyLOB": true, "GetRoleIsModifyAll.EDIsModifyAll": false}