Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
- </head>
- <body>
- <div ng-app="testApp" ng-controller="checkCtrl">
- <p>{{checkedOrNot}}</p>
- <label for="theCheck">Click here</label>
- <input type="checkbox" id="theCheck" name="theCheck" ng-click="updateSelection($event)">
- </div>
- <script>
- var app = angular.module('testApp', []);
- app.controller('checkCtrl', function($scope) {
- $scope.checkedOrNot = "No";
- $scope.updateSelection = function($event) {
- var cb = $event.target;
- var con = (cb.checked ? 'Yes' : 'No');
- $scope.checkedOrNot = con;
- };
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement