AngularJS - Checkbox with default value

In the following example, we set the values for our checkbox using ng-checked. The default values are set using ng-init; the same result is accomplished by initializing the value in the controller. When the user marks the checkbox as checked, we use the ng-click to change the value from true to false, or vice versa.

<div ng-init="options={};">
    <input id="option_1" type="checkbox" 
    <label for="option_1" >Option 1</label>

Note: ng-checked expects an expression.

For more information go to the AngularJS documentation


comments powered by Disqus