Execute
<!DOCTYPE html> <html> <head> <title>Wikitechy AngularJS Tutorial</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script> </head> <body> <form ng-app="myApp" ng-controller="checkboxCtrl"> <h3>input[checkbox] directive example</h3> <label>Checkbox1: <input type="checkbox" ng-model="value1"> </label><br/> <tt>Checkbox1 value = {{value1}}</tt><br/><br/> <label>Checkbox2: <input type="checkbox" ng-model="value2" ng-true-value="'Checked'" ng-false-value="'Unchecked'"> </label><br/> <tt>Checkbox2 value = {{value2}}</tt><br/> </form> <script> var app=angular.module('myApp', []); app.controller('checkboxCtrl', ['$scope', function($scope) { $scope.value1 = true; $scope.value2 = 'Checked'; }]); </script> </body> </html>
www.wikitechy.com © Copyright 2016. All Rights Reserved.