ng-false-value sets false value for checkbox

Description

The following code shows how to use ng-false-value to set false value for checkbox.

Example


<!DOCTYPE html>
<html  ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
</head><!--   w ww  .ja  v a2  s.  c  o  m-->
<body>
  <label class="checkbox">
  <input type="checkbox" 
         ng-model="user.role" 
         ng-true-value="admin" 
         ng-false-value="basic"> Is Administrator</label>
  
  <pre ng-bind="user | json"></pre>
</body>
</html>

Click to view the demo





















Home »
  AngularJS »
    AngularJS Example »




Controller
Directives
Expression
Filter
Form
Inject
Scope
Server
Style
Template
Utilities