R
R
Roman Rakzin2015-05-31 12:36:34
JavaScript
Roman Rakzin, 2015-05-31 12:36:34

How to prevent all checkboxes from being cleared?

Good afternoon.
There are several checkboxes - they are checked.
It is necessary to prevent the removal of all checkboxes - at least one must be selected. Those. the last selected one must not be removed.
How to do this in angularjs or just javascript?
Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dialog, 2015-05-31
@Dialog

On Angular, create an object for binding checkboxes. And a separate function under ng-click, inside on click you check the number of true in the object and, if there is more than one true, then you change the value.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question