AngularJS Tutorial - Bind two input checkbox to same model








The following code shows how to Bind two input checkbox to same model.

Example


<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
<style>
    .ng-invalid { border: 1px solid red; }
</style><!--  ww w. j  a  v a 2 s .  c  o  m-->
</head>
<body>
  <div ng-app>
  A - Check me to check both: 
    <input type="checkbox" ng-model="master"><br/>
  B - Check me to check both:
    <input type="checkbox" ng-model="master">
</div>
</body>
</html>

The code above is rendered as follows: