Answer the question
In order to leave comments, you need to log in
How to set checkbox to false when hidden via data-ng-show?
I have a sorting that I control the checkbox myself.
If you hide the checkbox using data-ng-show, then the checkbox remains and sorting continues according to the criterion that was on it. How to uncheck the checkbox when hiding?
<input type="checkbox" data-ng-model='kat' data-ng-true-value='1'/> Первый<br>
<input type="checkbox" data-ng-model='kat' data-ng-true-value='2'/> Второй<br>
<input type="checkbox" data-ng-model='search.w' data-ng-true-value='К Первому' data-ng-false-value='' data-ng-show="kat == 1" />К Первому<br>
<input type="checkbox" data-ng-model='search.p' data-ng-true-value='К Второму' data-ng-false-value='' data-ng-show="kat == 2" />К Второму<br>
Answer the question
In order to leave comments, you need to log in
I used Angularjs 1.0.8 and not everything worked there that I tried, installed 1.5.8 and ng-if worked for me, and I was also able to write conditions in ng-change. I have used "Ternary Conditional Operation" for conditions in ng-change.
Here's what happened:
<input type="checkbox" ng-model='uoper' ng-true-value="1" ng-false-value="0" ng-change="one=two=(uoper==1)?undefined:undefined" /> Снять <br>
<span ng-show="!uoper">
<input type="checkbox" ng-model='one' /> Первый<br>
<input type="checkbox" ng-model='two' /> Второй <br>
</span>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question