lundi 31 octobre 2016

Angular checkbox is unchecked even when attribute is present

I have a list of checkboxes and the first one basically empties an array and is checked when the array is empty

<input type="checkbox" data-ng-checked="groups.length == 0" data-ng-click="groups = []">

the problem is when I first click on the checkbox it's checked, when I click again on it, even if the array is empty and the checked attribute is present, the checkbox has the checked property false.

Is there a way to prevent this? I've tried to use $event.preventDefault() but that never changes the checkbox




Aucun commentaire:

Enregistrer un commentaire