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 Radio Button Checked Validation
Keywords : Angularjs validate radio button group example, Angularjs get radio button checked value example, Angularjs check if radio button selected or not validation example
Example
<!DOCTYPE html> <html> <head> <title> AngularJs Radio Buttons Validation to Check if Anyone Selected or Not </title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <script> var app = angular.module('radiobuttonApp', []); app.controller('radiobuttonCtrl', function ($scope) { $scope.arrlist = [{ "userid": 1, "name": "Suresh" }, { "userid": 2, "name": "Rohini" }, { "userid": 3, "name": "Praveen" }]; $scope.checkoptions = function (choice) { var details = []; if ($scope.selectedPerson!=undefined) $scope.msg = 'Selected Value: ' + $scope.selectedPerson; else $scope.msg = 'Please choose an option'; }; }); </script> </head> <body ng-app="radiobuttonApp" ng-controller="radiobuttonCtrl"> <div> <h3>AngularJS Radio Buttons Validation</h3> <div ng-repeat="user in arrlist"> <input type="radio" name="userdetails" value="{{user.userid}}" ng-model="$parent.selectedPerson" /> <label>{{user.name}}</label> </div><br /> <input type="button" id="btnClick" value="Submit" ng-click="checkoptions(arrlist)" /><br /><br /> <span style="color:Red">{{msg}}</span> </div> </body> </html>
Click Here to See Result
Result
Previous
Next