AngularJS Example

by ChrisP

HTML

<body ng-app="demoApp">
    <div ng-controller="DemoController">

            <select ng-model="mybool"
                ng-options="opt as opt.label for opt in options">
            </select>
        <p>
        The value selected is <b>{{ mybool.val }}</b>, the opposite is {{ !mybool.val }}
        </p>
    </div>
</body>

CSS

</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ --> 
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<style>
​.ng-invalid { border: 1px solid red; }​

JavaScript

angular.module('demoApp', []).controller('DemoController', function($scope) {

  $scope.options = [{ label: 'Not included', val: false }, { label: 'Included', val: true }];
  $scope.mybool = $scope.options[1];
    
});