I am using Angular 6/7 with reactive forms, I have a form with a list of permissions(two checkboxes in one row), for example, lets say each checkbox is a permission, by default the second checkbox in the row needs to be disabled on the first load and only enabled when the user clicks/checks the first checkbox in the row.
The flow:
- The user can only click on the first checkbox in the row, for example, permission1,2,3 or 4.
- If the user clicks/checks the first checkbox in the row, onChange event I need to enable the second checkbox.
- On Submit - I need to fetch the ids of permissions and also if the user clicked on the second checkbox in of the rows, I need to fetch/save that information as a boolean flag, for example, lets say canGrantPermission: true/false.
Super simple code example: https://stackblitz.com/edit/angular-ibb7ps
At the end I would like to have something like this:
permissions: [
{permissionId: 1, canGrant: false},
{permissionId: 2, canGrant: true}
]