javascript - checkbox is not getting checked in angular js -


<tr ng-repeat="languages in samln">    <td>       <span>{{languages.emplang}}</span>    </td>    <td>       <input type="checkbox" name="checkbox1-" id="sp1" value="false" style="margin-left:40px;" ng-model="languages.speak">    </td>    <td>       <input type="checkbox" name="checkbox2-" id="rea1" value="false" style="margin-left:40px;" ng-model="languages.read">    </td>    <td>       <input type="checkbox" name="checkbox3-" id= "wr1" value="false" style="margin-left:40px;" ng-model="languages.write">    </td> </tr> 

it has 2 string values true , false. gave value="false" checkbox not getting checked , here languages list.

<script>   angular.module('checkboxexample', [])     .controller('examplecontroller', ['$scope', function($scope) {       $scope.checkboxmodel = {        value1 : true,        value2 : 'yes'      };     }]); </script> <form name="myform" ng-controller="examplecontroller">   <label>value1:     <input type="checkbox" ng-model="checkboxmodel.value1">   </label><br/>   <label>value2:     <input type="checkbox" ng-model="checkboxmodel.value2"            ng-true-value="'yes'" ng-false-value="'no'">    </label><br/>   <tt>value1 = {{checkboxmodel.value1}}</tt><br/>   <tt>value2 = {{checkboxmodel.value2}}</tt><br/>  </form> 

source: angularjs documentation / api reference / ng / input components in ng / input[checkbox]


Comments