How to set false value in ng-model when my checkbox is not selected

I want to be false if the user checkbox is not checked.
  HTML code

On validation, the checkbox values ​​are set to "true" in addUser.isAllOrgSelected. But when the checkbox is not checked, the value is not set to "false".

           <input type="checkbox" id="checkbox-1-1" class="regular-checkbox" 
           ng-true-value="true" ng-false-value="false" ng-
             model="addUser.isAllOrgSelected">
                 <label for="checkbox-1-1"></label>
               <span class="check-text">ALL</span>

      

+3


source to share


1 answer


try adding a directive ng-checked

.

<input type="checkbox" 
    ng-model="addUser.isAllOrgSelected" 
    ng-true-value="true" 
    ng-false-value="false" 
    ng-checked="addUser.isAllOrgSelected " />

      



see example here

0


source







All Articles