Bind scope value to radio button

Description

The following code shows how to Bind scope value to radio button.

Example


<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
</head><!--  w  w w  . jav a 2  s.c om-->
<body ng-app ng-controller="testcontroller">
  <input type="radio" ng-model="lookup" value="1">Employee Lookup</input>
  <input type="radio" ng-model="lookup" value="5">Company Lookup</input>
<script type='text/javascript'>
function testcontroller($scope){
  $scope.lookup = 1;
}
</script>
</body>
</html>

Click to view the demo





















Home »
  AngularJS »
    AngularJS Example »




Controller
Directives
Expression
Filter
Form
Inject
Scope
Server
Style
Template
Utilities