Home
Tutorials
Microsoft Technologies Tutorials
Java Programming Tutorials
Web Designing Tutorials
Script Programming Tutorials
Database Programming Tutorials
Mobile Technologies Tutorials
Other Programming Tutorials
Examples
Articles
Tools
News
AngularJS CheckBoxes Example
Keywords : How to use checkboxes in angularjs with example, Angularjs checkboxes validation example, Angularjs check if checkbox selected or not example, Angularjs get checkbox selected value example
Example
<!DOCTYPE html> <html> <head> <title> AngularJs Checkboxes with Validation Example </title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <script> var app = angular.module('checkboxApp', []); app.controller('checkboxCtrl', function ($scope) { $scope.validationmsg = false; $scope.checkvalidation = function () { var chkselct = $scope.chkselct; if (chkselct == false || chkselct == undefined) $scope.validationmsg = true; else $scope.validationmsg = false; } }); </script> </head> <body ng-app="checkboxApp" ng-controller="checkboxCtrl"> <div> <h3>AngularJS Checkboxes with Validations Example</h3> Agree Terms and Conditions <input type="checkbox" ng-model="chkselct"><br /> <span style="color:red;" ng-show="validationmsg">Please select Checkbox</span><br /> <input type="button" value="Submit" ng-click="checkvalidation();" /> </div> </body> </html>
Click Here to See Result
Result
Previous
Next