How to set checkbox selected on the basis of model value
angularjs
Solution
Please, try to use: `ng-checked="ModelData.Animals == 'A'"`
More information about ng-checked: http://docs.angularjs.org/api/ng.directive:ngChecked
Problem
I have a checkbox and the value of this checkbox is fixed as 'A'. I want the checkbox selected if the model value matches with checkbox value attribute. ``` <div class="form-horizontal"> <label class="col-md-2"> <input type="checkbox" id="Animals" name="Animals" ng-model="ModelData.Animals" value="A" /> Animal(s) </label> </div> ``` But using the above code, checkbox selection is not working automatically. How can I achieve this?