HTML checkbox.
<input type="checkbox" ng-model="{string}" [name="{string}"] [ng-true-value="{string}"] [ng-false-value="{string}"] [ng-change="{string}"]>
ng-model – {string} –
Assignable angular expression to data-bind to.
name(optional) – {string=} –
Property name of the form under which the control is published.
ng-true-value(optional) – {string=} –
The value to which the expression should be set when selected.
ng-false-value(optional) – {string=} –
The value to which the expression should be set when not selected.
ng-change(optional) – {string=} –
Angular expression to be executed when input changes due to user interaction with the input element.
<script> function Ctrl($scope) { $scope.value1 = true; $scope.value2 = 'YES' } </script> <form name="myForm" ng-controller="Ctrl"> Value1: <input type="checkbox" ng-model="value1"> <br/> Value2: <input type="checkbox" ng-model="value2" ng-true-value="YES" ng-false-value="NO"> <br/> <tt>value1 = {{value1}}</tt><br/> <tt>value2 = {{value2}}</tt><br/> </form>
it('should change state', function() { expect(binding('value1')).toEqual('true'); expect(binding('value2')).toEqual('YES'); input('value1').check(); input('value2').check(); expect(binding('value1')).toEqual('false'); expect(binding('value2')).toEqual('NO'); });