mardi 29 octobre 2019

uncheck a checkbox which is checked and freezed with a condition in Angular 5

I have a table that iterates on JSON values, i have checkbox in the first column

requirement: when 5 checkboxes are selected, the user shouldn't be able to select the 6th checkbox, but he can deselect any in the 5 checkboxes

current scenario: i am able to freeze the checkboxes when the user selects 5 checkboxes but it isn't allowing me to deselect the selected checkbox

<checkbox [forbidden]="isFull() && Selected" [ngModel]="Selected" (ngModelChange)="Change(Result, $event)"> </checkbox>

checkbox is a custom component in my code base

` isFull(){
    return someService.Slots()===0; // availableSlots returns 5

} `

Change(Result, $event){ // some code irrelevant to the checkbox logic // Result holds the JSON value for iterating row }

Please provide a working plunker or any online editor for better understanding

Thanks in advance




Aucun commentaire:

Enregistrer un commentaire