lundi 3 octobre 2016

Angular JS & Semantic-UI checkbox needs double click

I try to operate with AngularJS on checkbox made with with Semantic UI:

<div class="ui checkbox" ng-click="myCtrl.value=!myCtrl.value">
<input type="checkbox" class="hidden" ng-model="myCtrl.value"/>
<label>Property</label>
</div>

It looks, like any copy of my Semantic-ui checkbox needs to be "activated" by a click. First click is changing the value, but not the appearance. Then my Semantic-ui checkbox is always one step behind - show the opposite state to the one saved under "value" variable.

I noticed, that as I use "normal" checkbox like this, clicking on the label works fine, but clicking on the input change it's state twice (returns to the first state):

<div ng-click="myCtrl.value=!myCtrl.value">
<label><input type="checkbox" ng-model="myCtrl.value"/> Property</label>
</div>

This is probably something really basic, but this is my first Angular project and really basic things are still really big problems:) Thank you.

Aucun commentaire:

Enregistrer un commentaire