
We can select only one of the available options in case of radio buttons, in case of Checkbox we can select more than one options.
Three
Four
Five
Your selection is {{class}}
<div ng-app="my_app" ng-controller="my_ctrl">
<input type=radio ng-model="class" value="Three"> Three
<input type=radio ng-model="class" value="Four"> Four
<input type=radio ng-model="class" value="Five"> Five
<br>
Your selection is {{class}}
</div>
<script>
var app = angular.module('my_app', []);
app.controller('my_ctrl', function($scope) {
});
</script>
Default selected radio button
We can't add the attribute checked to the radio button to make it selected by default. We have to set the value for ng-model to make it selected.
DEMO : Default selection of options of Radio buttons →
onChange event of radio button
We can assign onChange event to radio buttons to trigger specific code to execute.
DEMO : OnChange event of Radio buttons →
Setting radio buttons
We can set the value of 2nd group of radio buttons by rading the value of first group of buttons.
DEMO : Read and set the value of Radio buttons →
←Angular Home